Question

I've setup an "IDE" based on VIM and NERDTree for programming using FreePascal. Overall, it's working great, but I can't find how to tell NERDTree to change it's default behavior regarding VIM buffers.

Currently, every time I open a file in NERDTree, it creates a new buffer. If the file is already open in another buffer, it could be nice to have a shortcut to just go to the former buffer, instead of creating a new one for the same file. This could be specially usefull for programmers who must go back and forth between files.

Any hint?

Was it helpful?

Solution

OK, just had to read through my .vimrc (actually _vimrc :-( ) to see why it works for me.

According to the superb but slightly outdated Vim faq, an autocommand helps me:

 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
                     \ exe "normal g'\"" | endif   
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top