Search code examples
vimnerdtree

vim-NERDTree: order bookmarks?


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.


Solution

  • 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.