2012-02-07 104 views
2

我在.vimrc下面幾行:移動與<tab><s-tab>

nnoremap <tab> :wincmd w<cr> 
nnoremap <s-tab> :wincmd W<cr> 

我要趕緊使用普通模式下的Vim窗口之間移動。上述映射在窗口之間正常工作,但是當我到達MiniBufExplorer時,它會卡住,不會旋轉到第一個窗口。

我該如何映射它以使其不移入MiniBufExplorer?

+0

MiniBufExplorer可能不會被Vim視爲「常規」窗口。 – romainl 2012-02-07 06:19:58

回答

0

不完全是你要求的,但這些是在窗口之間移動的有用鍵盤快捷鍵。

map <c-j> <c-w>j 
map <c-k> <c-w>k 
map <c-h> <c-w>h 
map <c-l> <c-w>l 

這使得Ctrl + <direction>窗口之間移動(包括MiniBufExpl當它打開時)。 Tab可能更適合代碼完成,請查看SuperTab plugin

+0

謝謝,我有標籤完成映射到插入模式。 – Kit 2012-02-07 11:20:40

3

minibufexpl.vim插件中有兩行重新映射Tab以循環顯示MiniBufExplorer窗口中顯示的緩衝區名稱。如果您刪除/評論這些,您的標籤重新映射將工作。

nnoremap <buffer> <TAB> :call search('\[[0-9]*:[^\]]*\]')<CR>:<BS> 
nnoremap <buffer> <S-TAB> :call search('\[[0-9]*:[^\]]*\]','b')<CR>:<BS> 

此外,還有一些全局設置,低於此設置可以控制C-Tab功能在窗口或緩衝區之間進行切換。你可能想修改這些或至少知道這個功能。注意,你仍然需要移除上面的Tab映射來獲取Tab(而不是C-Tab)的移動。

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