A few questions regarding Vim NERDTree

  • Is it possible to set a default directory that always opens in the explorer window?
  • How do you move the cursor from the file explorer to the editor buffer? (in a regular gui-based editor, I would click on it)
  • How do you move the cursor from the editor buffer object to the file explorer?
+4
source share
3 answers

Try to enter ? . Before switching to NERDTree, I recommend that you first try the Netrw directory listing that is already installed with Snow Leopard Vim. I find it enough, simpler and faster.

Try this from the terminal:

 vim ~/Documents/ 

This should automatically open Netrw.

Then within Vim, type:

 :h netrw-intro-browse 

And read how to use Netrw.

To learn how to move the cursor to another window, enter:

 :h windows 

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

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

+4
source

1) I do not know how to do this, but I recommend bookmarks of frequently used folders instead. After you have created several bookmarks, you can run NERDTree as follows:

 :NERDTree bookmarkName 

2 and 3) I prefer to use a separate tab for each file. You have a pointer next to the name of the file you want to open in NERDTree, just press t to open it in a new tab. Although it is true that the first time you start NERDTree, it opens a separate buffer on the same tab. I usually click right there

 Ctrl-w w 

to go to another buffer and close it with: q, which will return you to the file explorer.

+1
source

1 . Perhaps you did not have this idea. How do you open NERDTree? Using the command :e , using the directory name as an argument, right? (remember that . is your current directory). This directory is then opened for visualization in the NERDTree window. Alternatively, you can use the command :NERDTree , also specifying the directory name as an argument and behaving like the previous case. The final option would be to call :NERDTree with no arguments, and this is the same as passing an argument . according to help. So you want to have a default directory that is technically illogical if it always opens in the directory you requested.

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

 nnoremap ,on :NERDTree ~/Desktop<CR> 

2 . You did not say what kind of Vim flavor you use. I use the GUI on my Mac called MacVim, and the mouse click works as you expect. Alternatively, check item 3.

3 . You can navigate between windows that contain buffered things using the <CW> command family. Read :h window-move-cursor to find out more, but in your case, if you are in the NERDTree window on the left and on the right side of the buffer in which you are concentrated, you can go to the NERDTree window by pressing CW h .

0
source

All Articles