Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically set size of terminal #289

Closed
nwaywood opened this issue Jun 16, 2020 · 2 comments · Fixed by #293
Closed

Dynamically set size of terminal #289

nwaywood opened this issue Jun 16, 2020 · 2 comments · Fixed by #293

Comments

@nwaywood
Copy link

nwaywood commented Jun 16, 2020

Is your feature request related to a problem? Please describe.
Depending on what I am doing, something I like to have a small terminal at the bottom of the screen (with a height of 10) and sometimes I like a terminal taking up half the screen in a vertical split (e.g. when the output of the command being run is long).

As far as I can tell, I don't believe this functionality is currently possible. If I don't set neoterm_size then the vertical split looks like I want but the horizontal split now takes up half the screen (obviously). If I set let g:neoterm_size = 10 in my init.vim then it looks like I want when I make a horizonal split but messes up the vertical split.

Describe the solution you'd like

  • Solution 1: Split neoterm_size into two different variables neoterm_size_horizontal and neoterm_size_vertical so that the two sizes can be set independently. If they are not set they, the fallback value could still be neoterm_size

  • Solution 2: Use neoterm_size as the default but allow the size to be set dynamically to override the default. e.g. :botright neoterm_size=10 Ttoggle

I personally prefer the second solution if it's possible (I don't really know vimscript enough to know if it's possible) since its more flexible.

Describe alternatives you've considered

As far as I can tell, having a different size for horizontal and vertical terminals isn't possible to do currently

Additional context

Horizontal split how I want it by setting let g:neoterm_size = 10:

image

Messed up vertical split when let g:neoterm_size = 10 is set:

image

@kassio kassio linked a pull request Jul 24, 2020 that will close this issue
@kassio
Copy link
Owner

kassio commented Jul 26, 2020

@nwaywood Thanks for the suggestion. I started to work on a solution in #293, can you try that and see if it works? It should be working for :Topen and :Ttoggle commands, like:

  • :Topen resize=10
  • vert :Ttoggle resize=32

@nwaywood
Copy link
Author

nwaywood commented Jul 27, 2020

Hey @kassio,

Thanks so much for implementing my suggestion!

I just tried it out and I have one question, is it possible to tell the resize argument to do an even split instead of providing a specific number?

The reason I ask is because I ran into the following situation:

  1. Make a vertical terminal with :vert :Ttoggle, it creates an even split since it's the default.
  2. Close the terminal with :Ttoggle
  3. Open a horizontal split with :botright :Ttoggle resize=10
  4. Close the terminal with :Ttoggle
  5. Open a vertical split again with :vert :Ttoggle

Now the vertical terminal is 10 columns wide instead of an even split like it was the first time. I understand this is because the resize argument is cached and is used by both vertical and horizontal commands, but if we were able to do something like resize='' the above issue could be avoid by using :vert :Ttoggle resize='' instead of :vert :Ttoggle


Edit: Nevermind I just actually tried :vert :Ttoggle resize= and it works 😅 Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants