How can I create a keymap that shifts focus to a split window and maximizes its width and height?

131 views Asked by At

I use split windows in Vim, and I have the following keymap in my .vimrc: nnoremap <C-l> <C-w>l This makes it possible for me to use CTRL-l to focus on the window to the right. However, I still have to maximize its width and height with CTRL-w | and CTRL-w _.

To achieve this, I tried modifying my keymap so that pressing CTRL-l focuses on the window to the right and maximizes its width and height. My first attempt was nnoremap <C-l> <C-w>l<C-w>|<C-w>_, but this resulted in an error. Next, I tried to only increase the width of the window to the right after shifting focus to it nnoremap <C-l> <C-w>l<C-w>| This does not produce an error, but it also does not increase the width of the window to the right (after shifting focus to it). What am I doing wrong in my keymap?

I know that I can make the current window the only one on the screen with CTRL-w_o, but this is not what I'm looking for.

0

There are 0 answers