使用在 Vim 窗口之间移动和

发布于 2025-01-03 07:05:07 字数 281 浏览 0 评论 0原文

我的 .vimrc 中有以下几行:

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

我想在正常模式下快速在 Vim 窗口之间移动。上面的映射在窗口之间工作正常,但是当我到达 MiniBufExplorer 时,它被卡住并且不会旋转到第一个窗口。

我应该如何映射它,以便它不会移动到 MiniBufExplorer 中?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

兮颜 2025-01-10 07:05:07

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

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
雨夜星沙 2025-01-10 07:05:07

不完全符合您的要求,但这些是在窗口之间移动的有用键盘快捷键。

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 + 在窗口之间移动(包括打开时的 MiniBufExpl)。 Tab 可能更适合代码完成,请查看 SuperTab 插件

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文