Automatically switch back to NerdTree after pressing "o" on file

551 views Asked by At

When I press "o" on any file in NerdTree list, it opens this file in one of currently opened tabs. Sometimes, when I'm not 100% sure what file to open, I have to do this:

1) o (open file)

2) ctrl-ww (switch back to nerdtree)

3) j or k (go to next file) repeat 1-3 many times

I want to be able to press Alt-o to open file and switch back to NerdTree. I tried this:

map <M-o> o<C-w>w

map <M-o> oC-ww

and both didn't work. What is wrong and how can I fix my mapping?

1

There are 1 answers

0
Ingo Karkat On BEST ANSWER

This is built into the plugin; the go command does this:

go Open selected file, but leave cursor in the NERDTree