I tried to change the NERDTree root with
:BookmarkToRoot <bookmark>
command and with C
letter but when I close vim and open vim the root is not changed.
Do you know how to change the root forever?
Use Vim's built-in :cd command to change directory, followed by the NERDTree CD command (note: that's a normal-mode mapping, not an Ex : command.) (Note that tab completion will work here to complete the directory name.) Then use CD in the NERDTree pane to use the current directory as the new root.
(1) Thus, if your edit window is to the right of the NERDTree window, you would use: ctrl + W l to go to right window and ctrl + W h to go to left window. or ctrl + w twice to toggle between the two.
Step 1: using autochdir 'autochdir' 'acd' boolean (default off) global When on, Vim will change the current working directory whenever you open a file, switch buffers, delete a buffer or open/close a window. It will change to the directory containing the file which was opened or selected.
To rename a file in NerdTree, navigate to it, then press mm . It will open a prompt with the old full path already written for you, which you can modify to type the new name of the file.
You could try something like:
nnoremap <leader>n :NERDTree /path/to/folder<CR>
I have this in my .vimrc:
set autochdir let NERDTreeChDirMode=2 nnoremap <leader>n :NERDTree .<CR>
so that NERDTree always opens in the current folder.
With the 1st line, the working directory is always the one where the active buffer is located.
With the 2nd line, I make sure the working directory is set correctly.
With the 3rd line, I hit <leader>n
to open NERDTree.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With