如何从选项卡中的文件跳转回 NERDTree?

发布于 2024-08-09 03:09:50 字数 256 浏览 11 评论 0原文

我通常:

  1. 选择需要的文件。
  2. 在选项卡中打开它(默认为 t 字符)。

但是我如何跳回 NERDTree 在选项卡中再打开一个文件呢?

我现在在 .vimrc 文件中使用的临时解决方案:

map <F10> :NERDTree /path/to/root/of/my/project

但是从根目录一次又一次地开始导航并不是很有用。

I usually:

  1. Choose the needed file.
  2. Open it in a tab(t character, by default).

But how I can jump back to NERDTree to open one more file in a tab?

Temporary solution I use now in my .vimrc file:

map <F10> :NERDTree /path/to/root/of/my/project

But it's not very useful to start navigation again and again from the root directory.

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

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

发布评论

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

评论(13

长途伴 2024-08-16 03:09:50

Ctrl-ww

这将在打开的窗口之间移动(这样你就可以在 NERDTree 窗口、你正在编辑的文件和帮助窗口之间跳转) ,例如...只需按住 Ctrl 并按 w 两次)。

Ctrl-ww

This will move between open windows (so you could hop between the NERDTree window, the file you are editing and the help window, for example... just hold down Ctrl and press w twice).

半衾梦 2024-08-16 03:09:50

Ctrl+ww 循环浏览所有窗口

Ctrl+wh 带您离开一个窗口

Ctrl+wj 带您向下一个窗口

Ctrl+wk 使您向上一个窗口

Ctrl+wl 使您向右一个窗口

Ctrl+ww cycle though all windows

Ctrl+wh takes you left a window

Ctrl+wj takes you down a window

Ctrl+wk takes you up a window

Ctrl+wl takes you right a window

木落 2024-08-16 03:09:50

NERDTree 将在另一个窗口中打开。你看到的是那个分割视图吗?用 vim 的话说,它们被称为窗口。所有窗口命令均以 CTRL-W 开头。要从左右相邻的窗口移动,您可以使用 CTRL-w h 将焦点更改到当前窗口左侧的窗口,然后使用 CTRL-w l 将焦点向右移动。同样,CTRL-w jCTRL-w k< /kbd> 将使您在水平分割的窗口之间移动(即一个窗口位于另一个窗口之上)。正如 此处所述,您还可以使用 Windows 执行更多操作。

您还可以使用 :NERDTreeToggle 命令来创建您的树打开和关闭。我通常会绑定那个。

NERDTree opens up in another window. That split view you're seeing? They're called windows in vim parlance. All the window commands start with CTRL-W. To move from adjacent windows that are left and right of one another, you can change focus to the window to the left of your current window with CTRL-w h, and move focus to the right with CTRL-w l. Likewise, CTRL-w j and CTRL-w k will move you between horizontally split windows (i.e., one window is above the other). There's a lot more you can do with windows as described here.

You can also use the :NERDTreeToggle command to make your tree open and close. I usually bind that do t.

挽手叙旧 2024-08-16 03:09:50

如果您使用 T 而不是 t ,则无需跳回,因为新选项卡将打开,但 vim 的焦点将仅保留在 NERDTree 内。

If you use T instead of t there is no need to jump back because the new tab will be opened, but vim's focus will simply remain within NERDTree.

宣告ˉ结束 2024-08-16 03:09:50

您可以使用# ctrl-ww 将焦点集中在分割窗口上。

例如,按:

1 ctrl-ww

将聚焦在第一个窗口,通常是 NERDTree。

You can focus on a split window using # ctrl-ww.

for example, pressing:

1 ctrl-ww

would focus on the first window, usually being NERDTree.

最丧也最甜 2024-08-16 03:09:50

因为它没有被提及,但它确实很有帮助:

ctrl-wp

,我将其记住为转到之前选择的窗口

它的工作原理是那里和后面命令。在新窗口中从树中打开新文件后,按ctrl-wp切换回到NERDTree并再次使用它<强>返回到您之前的窗口。

PS:值得一提的是 ctrl-wp 实际上被记录为转到预览窗口(请参阅::help预览窗口:help ctrl-w)。

这也是唯一可以在内部切换并探索 COC 预览文档窗口

Since it's not mentioned and it's really helpful:

ctrl-wp

which I memorize as go to the previously selected window.

It works as a there and back command. After having opened a new file from the tree in a new window press ctrl-wp to switch back to the NERDTree and use it again to return to your previous window.

PS: it is worth to mention that ctrl-wp is actually documented as go to the preview window (see: :help preview-window and :help ctrl-w).

It is also the only keystroke which works to switch inside and explore the COC preview documentation window.

软甜啾 2024-08-16 03:09:50

ctrl-ww 当您打开的选项卡有限时可能很有用。但当您打开太多标签时可能会很烦人。

我再次输入 :NERDTree 以便立即将焦点返回到 NERDTree 选项卡上,无论我的光标焦点在哪里。希望有帮助

ctrl-ww Could be useful when you have limited tabs open. But could get annoying when you have too many tabs open.

I type in :NERDTree again to get the focus back on NERDTree tab instantly wherever my cursor's focus is. Hope that helps

记忆之渊 2024-08-16 03:09:50

这里的热门答案提到使用 T 在新选项卡中静默打开文件,或 Ctrl+W< kbd>W 在文件正常打开后跳回 nerd-tree 窗口。

如果使用缓冲区:使用 go 在新的缓冲区中打开文件,静默,这意味着您的注意力仍将集中在 nerd-tree 上。

使用它可以快速打开多个文件:)

The top answers here mention using T to open a file in a new tab silently, or Ctrl+WW to hop back to nerd-tree window after file is opened normally.

IF WORKING WITH BUFFERS: use go to open a file in a new buffer, silently, meaning your focus will remain on nerd-tree.

Use this to open multiple files fast :)

剧终人散尽 2024-08-16 03:09:50

您可以通过 ctrl-pgupctrl-pgdown 更改选项卡。在该选项卡上,您来自 NERDTree 的选项卡仍处于选中状态,您可以打开另一个选项卡。

You can change the tabs by ctrl-pgup and ctrl-pgdown. On that tab you came from the NERDTree is still selected and you can open another tab.

避讳 2024-08-16 03:09:50

在 NERDTree 的最新版本中,您可以使用命令 :NERDTreeFocus,该命令会将焦点移动到 NERDTree 窗口。

In more recent versions of NERDTree you can use the command :NERDTreeFocus, which will move focus to the NERDTree window.

桃扇骨 2024-08-16 03:09:50

gt = 下一个点击
gT = 上一个选项卡

gt = next Tap
gT = previous Tab

鸩远一方 2024-08-16 03:09:50

如果需要,可以启用鼠标支持编辑 ~/.vimrc 文件。

输入 set mouse=a

在 NERDTree 中启用文件单击后,

if you want you can enable the mouse support editing ~/.vimrc file.

put set mouse=a

after that you enable files click in NERDTree.

宁愿没拥抱 2024-08-16 03:09:50

所有快捷键和功能都在

按 CTRL-?

All The Shortcuts And Functionality is At

press CTRL-?

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