Reputation: 31513
I have the following lines in my .vimrc
:
nnoremap <tab> :wincmd w<cr>
nnoremap <s-tab> :wincmd W<cr>
I want to move between Vim windows quickly using in Normal Mode. The above mappings work all right between windows, but when I get to the MiniBufExplorer, it gets stuck and doesn't rotate to the first window.
How should I map this so that it doesn't move into MiniBufExplorer?
Upvotes: 2
Views: 1285
Reputation: 31
There are two lines in the minibufexpl.vim plugin that remap Tab to cycle through the buffer names shown in the MiniBufExplorer window. If you remove/comment these, your tab remapping will work.
nnoremap <buffer> <TAB> :call search('\[[0-9]*:[^\]]*\]')<CR>:<BS>
nnoremap <buffer> <S-TAB> :call search('\[[0-9]*:[^\]]*\]','b')<CR>:<BS>
Additionally, there are global settings below which already control the C-Tab functionality for switching between either windows or buffers. You may want to modify these or at least be aware of this feature. NB, you will still have to remove the above Tab mapping to get Tab (instead of C-Tab) based movement.
if !exists('g:miniBufExplMapCTabSwitchBufs')
let g:miniBufExplMapCTabSwitchBufs = 0
endif
" Notice: that if CTabSwitchBufs is turned on then
" we turn off CTabSwitchWindows.
if g:miniBufExplMapCTabSwitchBufs == 1 || !exists('g:miniBufExplMapCTabSwitchWindows')
let g:miniBufExplMapCTabSwitchWindows = 1
endif
" If we have enabled <C-TAB> and <C-S-TAB> to switch buffers
" in the current window then perform the remapping
"
if g:miniBufExplMapCTabSwitchBufs
noremap <C-TAB> :call <SID>CycleBuffer(1)<CR>:<BS>
noremap <C-S-TAB> :call <SID>CycleBuffer(0)<CR>:<BS>
endif
" If we have enabled <C-TAB> and <C-S-TAB> to switch windows
" then perform the remapping
"
if g:miniBufExplMapCTabSwitchWindows
noremap <TAB> <C-W>w
noremap <S-TAB> <C-W>W
endif
Upvotes: 3
Reputation: 8035
Not exactly what you asked for but these are useful keyboard shortcuts to move between windows.
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-h> <c-w>h
map <c-l> <c-w>l
This makes Ctrl + <direction>
move between windows (including MiniBufExpl when it's open). Tab is probably better reserved for code completion, check out the SuperTab plugin.
Upvotes: 0