Disable NERDTree window when opening file in Vim

589 views Asked by At

Is there a way of disabling NERDTree when opening a file? When I open a file in mvim (using --remote-silent) and a NERDtree window is currently active, the file will open in that (narrow) window. How can I configure Vim to select another window if available and to open one if not?

1

There are 1 answers

5
Ingo Karkat On BEST ANSWER

There's no way to intercept the --remote-silent; you have to send explict commands to open the file with --remote-send instead. There, you can encode logic to deal with the NERDTree window, e.g. to move to the previous one if it is active:

$ gvim --remote-send "<C-\><C-n>:if &ft == 'nerdtree'|wincmd p|endif|edit filename<CR>"