Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

easier way to navigate between vim split panes

Tags:

vim

navigation

I am using NERDTree on vim and usually open files with i

Is there an easy way to switch between different panes? Currently I use CTRL+W+W to move from one pane to another.

like image 647
Omnipresent Avatar asked May 19 '11 03:05

Omnipresent


2 Answers

Long ago I found a tip (once on vim.org, now on wikia, apparently) that I've stuck with. Remap ctrl-[hjkl] to navigate splits. It has served me well.

" Use ctrl-[hjkl] to select the active split! nmap <silent> <c-k> :wincmd k<CR> nmap <silent> <c-j> :wincmd j<CR> nmap <silent> <c-h> :wincmd h<CR> nmap <silent> <c-l> :wincmd l<CR> 
like image 166
overthink Avatar answered Sep 24 '22 00:09

overthink


I prefer hitting single keys over hitting key-chords. The following maps pane movement to arrow keys:

" Smart way to move between panes map <up> <C-w><up> map <down> <C-w><down> map <left> <C-w><left> map <right> <C-w><right> 
like image 34
deadghost Avatar answered Sep 20 '22 00:09

deadghost