Tuesday, August 11, 2015

Re: prevent resizing of particular buffer

On Di, 11 Aug 2015, taschentuch@posteo.de wrote:

> i have that here
>
> nnoremap <s-j> <C-w>-
> nnoremap <s-k> <C-w>+

Are you sure, you want to map away 'J' and 'K'? If so, you might want to
use J and K directly. It is certainly cleaner and I am not exactly
certain, that <s-j> will work. In any case, you might want to read at
:h J and :h K to see, what you map away.

> in my vimrc. In a single buffer, Shift-j results in resizing my
> airline buffer. (Im not sure about that, but i think the airline
> "statusline" is a seperate buffer)

No, airline is a statusline. That is no buffer. You are simply
decreasing the window size and therefore increasing the command line
(e.g. where you enter ':' ex commands)

> Anyways, how can i prevent that resizing?

Use an expression mapping, e.g. something like this
nnoremap <expr> <c-w>j winnr('$')>1?'<c-w>-':''

This maps Ctrl-W j to decrease the window size, only if there are
several windows open, else do nothing.

See
:h :map-<expr>
:h winnr()
:h expr1

Best,
Christian
--
Wenn die Kuh am Himmel schwirrt, dann hat sich die Natur geirrt.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment