112

我刚刚开始为我的项目使用 NERDTree vim 插件。

我找不到在打开的标签之间切换的文档。谁能告诉我快捷键[s]?

谢谢...

4

10 回答 10

216

除了 Michael Madsen 列出的选项之外,还有一个选项(也是我个人的选择):

gt= 下一个标签

gT= 上一个标签

于 2010-03-09T22:33:34.247 回答
37

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.

  • Control+l moves to the next tab
  • Control+h moves to the previous tab
  • Control+n creates a new tab
于 2010-03-10T06:15:24.213 回答
15

快速签入:h tabs显示它CTRL-Page Down在选项卡之间循环。您也可以使用:tabnext命令(:tabn简称)。

于 2010-03-09T22:25:41.353 回答
12

我在 Mac 上使用 iTerm,我喜欢能够使用 Shift-[左箭头键] 和 Shift-[右箭头键] 切换到下一个/上一个选项卡

在我的 .vimrc 中,这里是如何在 MacVim 中做同样的事情;

  map <S-Right> :tabn<CR>
  map <S-Left>  :tabp<CR>

仅供参考,默认情况下,组合键 Cmd-Shift-[ 和 Cmd-Shift-] 将在 MacVim 中的选项卡之间切换(以及在 Google Chrome、Safari 和其他一些东西中)

于 2012-11-15T13:03:13.207 回答
7

我的设置

map <F2> :NERDTreeToggle<cr>
map <C-Right> :tabn<cr>
map <C-Left> :tabp<cr>
于 2013-11-14T20:05:49.997 回答
7

要启用像 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 键,或使用这些键的某种组合。

于 2014-10-21T14:47:55.567 回答
7

'{TabNumber} + gt'将允许您切换到 tab {TabNumber}

例如,转到选项卡 1 将键入“1”,然后键入“g”和“t”。

选项卡编号从左到右递增。

于 2017-05-11T00:04:12.227 回答
6

Ctrl + ww循环通过所有窗口

Ctrl + wh带你离开一个窗口

Ctrl + wj带你去一扇窗

Ctrl + wk带你上一扇窗

Ctrl + wl带你到一个窗口

于 2020-08-26T20:01:17.513 回答
3

添加到 digitalronin 的答案中,我认为用于切换选项卡的主要浏览器快捷方式(至少在 Chrome 和 Firefox 中)是选项+命令+向右或向左箭头。

如果你想让你的 NERDTree Vim 设置与此保持一致,那么这个变体就可以了。

 map <D-A-Right> :tabn<CR>
 map <D-A-Left>  :tabp<CR>
于 2013-02-07T00:24:44.230 回答
0

您可以将 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 标签页

于 2021-07-24T12:05:54.787 回答