Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim-NERDTree: order bookmarks?

Tags:

vim

nerdtree

Is there a way to order the bookmarks I see with the NERDTree vim plugin?

I feel like this should be simple, but I don't know how to do this. I vim'ed ~/.NERDTreeBookmarks and saw that in that file, the bookmarks are in the right order, but it seems to continuously reorganize the bookmarks according to the order I use them -- which is not what I want. I also did :ReadBookmarks command and that didn't seem to change order.

like image 294
Alexander Bird Avatar asked Jul 04 '11 09:07

Alexander Bird


1 Answers

I had the same problem, and managed to turn off NERDTree's wacky bookmark sorting. Open the NERD_tree.vim plugin file (usually ~/.vim/plugin/NERD_tree.vim). Search for this line:

call s:Bookmark.Sort()

There should be two instances of the line (in NERDTree version 4.2.0 they're on lines 209 and 286). Comment out both lines by adding " in front of them like this:

"call s:Bookmark.Sort()

Now you can edit ~/.NERDTreeBookmarks and your bookmarks will show up in NERDTree in the same order as in the file. You can use :ReadBookmarks to refresh your bookmarks list after editing the file.

like image 157
alxm Avatar answered Sep 17 '22 12:09

alxm