A simpler way to move between split vim glasses

I use NERDTree on vim and usually open files with i

Is there an easy way to switch between different panels? I am currently using CTRL+W+W to switch from one panel to another.

+43
vim navigation
May 19 '11 at 3:03 a.m.
source share
5 answers

Once upon a time, I found a tip (once on vim.org, now on Wikia, apparently) that I'm stuck with. Remap ctrl-[hjkl] to navigate. It served me well.

 " Use ctrl-[hjkl] to select the active split! nmap <silent> <ck> :wincmd k<CR> nmap <silent> <cj> :wincmd j<CR> nmap <silent> <ch> :wincmd h<CR> nmap <silent> <cl> :wincmd l<CR> 
+63
May 19 '11 at 3:11
source share

Key mappings are definitely the way to go. I use the comparisons mentioned above. I also include the following mappings in my vimrc to move the partitions themselves.

 " Move the splits arround! nmap <silent> <csk> <CW>k nmap <silent> <csj> <CW>j nmap <silent> <csh> <CW>h nmap <silent> <csl> <CW>l 

This makes it so that if the split opens in the wrong place (say, the left side, and I want it on the right), I go to that split and <CSl> , and the split moves to where I want.

+3
May 19 '11 at 14:17
source share

I prefer to hit single keys on keystroke. The following cards move in arrows:

 " Smart way to move between panes map <up> <Cw><up> map <down> <Cw><down> map <left> <Cw><left> map <right> <Cw><right> 
+3
Jan 28 '14 at 4:14
source share

To match tab changes via gt and gT, I'm currently trying to map g to change splitting. I lean toward the shift key when I follow the Ctrl key, so that helps me avoid this error until I get better if I don't.

 nnoremap gh <CW><CH> nnoremap gj <CW><CJ> nnoremap gk <CW><CK> nnoremap gl <CW><CL> 
0
Mar 25 '14 at 20:43
source share

I know this is an old question, but I have a great way. Using the split number.

split_number Cw Cw

for example, to go to section 3, do it 3 Cw Cw , press Ctrl-w twice.

0
Nov 14 '17 at 19:53 on
source share



All Articles