vim - 使用 <tab> 和 <s-tab> 在 Vim 窗口之间移动

标签 vim window keyboard-shortcuts minibufexplorer

我的 .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/

相关文章:

keyboard-shortcuts - 谷歌搜索选项卡快捷方式不起作用

regex - 用于 “abcd”的vim正则表达式,其中 “bc”是可选的?

Vim:尝试修改拼写检查器以排除 "rare"个单词

vim - OS X Lion 上的 slimv 段错误

wpf - 在 shell View 模型类中的属性上绑定(bind) WPF 窗口标题的问题 [Caliburn.Micro]

Android 键盘输入预定义文本

javascript - 在 Coffee.vim 中修改注释突出显示时出现问题

c# - HtmlWindow.Error 未捕获脚本错误 .NET

vim: "extend"窗口进入下一个窗口

javascript - 重用相同的shortcut.js函数来处理键盘输入