我的 .vimrc
中有以下几行:
nnoremap <tab> :wincmd w<cr>
nnoremap <s-tab> :wincmd W<cr>
我想在普通模式下快速在 Vim 窗口之间移动。上面的映射在窗口之间工作正常,但是当我到达 MiniBufExplorer 时,它被卡住并且不会旋转到第一个窗口。
我应该如何映射它,以便它不会移动到 MiniBufExplorer 中?
最佳答案
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
关于vim - 使用 <tab> 和 <s-tab> 在 Vim 窗口之间移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9170473/