关于Vim NERDTree的几个问题

发布于 2024-11-02 14:20:24 字数 134 浏览 7 评论 0原文

  1. 是否可以设置资源管理器窗口始终打开的默认目录?
  2. 如何将光标从文件资源管理器移动到编辑器缓冲区? (在普通的基于 GUI 的编辑器上,我会单击它)
  3. 如何将光标从编辑器缓冲区移动到文件资源管理器?
  1. Is it possible to set a default directory that the explorer window always opens up in?
  2. How do you move cursor from the file explorer to the editor buffer? (on a normal gui-based editor I'd click onto it)
  3. How do you move the cursor from the editor buffer thing to the file explorer?

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

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

发布评论

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

评论(3

镜花水月 2024-11-09 14:20:24

尝试输入 ?。在切换到 NERDTree 之前,我建议首先尝试 Netrw Directory Listing,它已随 Snow Leopard 的 Vim 一起安装。我发现它足够、更容易、更快。

从终端试试这个:

vim ~/Documents/

这应该会自动打开 Netrw。

然后,在 Vim 中输入:

:h netrw-intro-browse

并且,阅读如何使用 Netrw。

要了解如何将光标移动到另一个窗口,请输入:

:h windows

然后,您将看到 window-move-cursor,因此输入 :h window-move-cursor

它是 < code>CTRL-W j,其中 j 也可以是 hkl

Try typing ?. Before switching to NERDTree, I recommend first trying Netrw Directory Listing, which comes already installed with Snow Leopard's Vim. I find it sufficient, easier, and faster.

Try this from Terminal:

vim ~/Documents/

That should open Netrw automatically.

Then, within Vim, type:

:h netrw-intro-browse

And, read up on how to use Netrw.

To learn how to move your cursor to another window, type:

:h windows

Then, you'll see window-move-cursor, so type :h window-move-cursor

It's CTRL-W j, where j can also be h, k, or l.

挽袖吟 2024-11-09 14:20:24

1)我不知道有什么方法可以做到这一点,但我建议为常用文件夹添加书签。创建一些书签后,您可以像这样启动 NERDTree:

:NERDTree bookmarkName

2 & 3)我更喜欢为每个文件使用单独的选项卡。如果您将光标放在要在 NERDTree 中打开的文件名旁边,只需按 t 键即可在新选项卡中打开它。尽管确实,当您第一次启动 NERDTree 时,它​​确实会在同一选项卡中打开一个单独的缓冲区。我通常会立即按

Ctrl-w w

进入另一个缓冲区并使用 :q 关闭它,这将带您返回文件资源管理器。

1) I don't know of a way to do that, but I recommend bookmarking frequently used folders instead. Once you have created some bookmarks, you can launch NERDTree like this:

:NERDTree bookmarkName

2 & 3) I prefer to use a separate tab for each file. One you have the cursor next to the file name you want to open within NERDTree, you just press t to open it in a new tab. Although it is true that when you first launch NERDTree it does open a separate buffer in the same tab. I usually immediately press

Ctrl-w w

to get to the other buffer and close it with :q which will take you back to the file explorer.

可爱暴击 2024-11-09 14:20:24

1。也许你没有明白。如何打开 NERDTree?使用 :e 命令,使用目录名称作为参数,对吧? (请记住,. 是您当前的目录)。然后,该目录将打开并在 NERDTree 窗口中可视化。或者,您可以使用 :NERDTree 命令,同时提供目录名称作为参数,其行为与前一种情况类似。根据帮助,最后一个选项是不带参数调用 :NERDTree ,这与传递 . 参数相同。因此,您希望有一个默认目录,如果它始终在您询问的目录上打开,那么这在技术上是不合逻辑的。

现在,如果问题是 :NERDTree ~/Desktop 需要输入太多内容,请为其创建一个映射。

nnoremap ,on :NERDTree ~/Desktop<CR>

2.你还没有说你使用的是哪种 Vim 风格。我在 Mac 上使用名为 MacVim 的 GUI,并且用鼠标单击可以按您的预期工作。检查第 3 项作为替代方案。

3。您可以使用 系列命令在包含缓冲区内容的窗口之间移动。阅读 :h window-move-cursor 了解更多信息,但就您而言,如果您的 NERDTree 窗口位于左侧,缓冲区位于右侧,它可以保持您的焦点,那么您可以按 CWh 移动到 NERDTree 窗口。

1.Maybe you didn't got the idea. How do you open the NERDTree? With a :e command, using a directory name as argument, right? (remember, the . is your current directory). Then, that directory is opened to be visualized in the NERDTree window. Alternatively, you can use the :NERDTree command, also giving a directory name as argument and behaving like the previous case. The last option would be to call :NERDTree without arguments, and that is the same as passing the . argument, according to the help. So, you want to have a default directory, which is technically illogical, if it always open on the directory you asked.

Now, if the problem is that :NERDTree ~/Desktop<enter> is so much typing, create a mapping for that.

nnoremap ,on :NERDTree ~/Desktop<CR>

2.You haven't said what kind of Vim flavor you're using. I use a GUI on my Mac called MacVim, and clicking with the mouse works as you expect. Check item 3 as an alternative.

3.You can move between windows which contain buffer things with the <C-W> family of commands. Read :h window-move-cursor to know more, but in your case, if you're with the NERDTree window on the left and the buffer thing on the right, which holds your focus, you can move to the NERDTree window by pressing C-Wh.

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