我刚刚开始为我的项目使用 NERDTree vim 插件。
我找不到在打开的标签之间切换的文档。谁能告诉我快捷键[s]?
谢谢...
除了 Michael Madsen 列出的选项之外,还有一个选项(也是我个人的选择):
gt
= 下一个标签
gT
= 上一个标签
I like to bind my vim navigation keys to switching between tabs. Here are the lines from my .vimrc
file:
map <C-l> :tabn<CR>
map <C-h> :tabp<CR>
map <C-n> :tabnew<CR>
That way, I can switch between tabs using the left and right buttons just like I normally would move the cursor, except I just hold the Control key as well.
快速签入:h tabs
显示它CTRL-Page Down在选项卡之间循环。您也可以使用:tabnext
命令(:tabn
简称)。
我在 Mac 上使用 iTerm,我喜欢能够使用 Shift-[左箭头键] 和 Shift-[右箭头键] 切换到下一个/上一个选项卡
在我的 .vimrc 中,这里是如何在 MacVim 中做同样的事情;
map <S-Right> :tabn<CR>
map <S-Left> :tabp<CR>
仅供参考,默认情况下,组合键 Cmd-Shift-[ 和 Cmd-Shift-] 将在 MacVim 中的选项卡之间切换(以及在 Google Chrome、Safari 和其他一些东西中)
我的设置
map <F2> :NERDTreeToggle<cr>
map <C-Right> :tabn<cr>
map <C-Left> :tabp<cr>
要启用像 firefox 这样的 Tab 导航,请将其添加到您的 vimrc:
nnoremap <C-S-tab> :tabprevious<CR>
nnoremap <C-tab> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
inoremap <C-S-tab> <Esc>:tabprevious<CR>i
inoremap <C-tab> <Esc>:tabnext<CR>i
inoremap <C-t> <Esc>:tabnew<CR>
inoremap <C-S-w> <Esc>:tabclose<CR>
这也派上用场<A-Fn>
用于转到第 n 个标签页
nnoremap <A-F1> 1gt
nnoremap <A-F2> 2gt
nnoremap <A-F3> 3gt
nnoremap <A-F4> 4gt
nnoremap <A-F5> 5gt
nnoremap <A-F6> 6gt
nnoremap <A-F7> 7gt
nnoremap <A-F8> 8gt
nnoremap <A-F9> 9gt
nnoremap <A-F10> 10gt
在哪里,
C --> ctrl key
S --> Shift key
A --> Alt key
F1-10 --> Are the function keys
注意:Alt + f4 通常用于关闭窗口。所以检查一下。如果问题仍然存在,您始终可以映射 Ctrl 或 Shift 键而不是 Alt 键,或使用这些键的某种组合。
'{TabNumber} + gt'
将允许您切换到 tab {TabNumber}
。
例如,转到选项卡 1 将键入“1”,然后键入“g”和“t”。
选项卡编号从左到右递增。
Ctrl + ww
循环通过所有窗口
Ctrl + wh
带你离开一个窗口
Ctrl + wj
带你去一扇窗
Ctrl + wk
带你上一扇窗
Ctrl + wl
带你到一个窗口
添加到 digitalronin 的答案中,我认为用于切换选项卡的主要浏览器快捷方式(至少在 Chrome 和 Firefox 中)是选项+命令+向右或向左箭头。
如果你想让你的 NERDTree Vim 设置与此保持一致,那么这个变体就可以了。
map <D-A-Right> :tabn<CR>
map <D-A-Left> :tabp<CR>
您可以将 vim 配置为使用Ctrl+ 箭头键在选项卡之间切换。
Ctrl+←</kbd> arrow will switch to tab that is on the left of current tab.
Ctrl+→</kbd> arrow will switch to tab that is on the right of current tab.
要实现上述行为,请使用以下几行更新您的 vimrc:
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
参考:使用 vim 标签页