commit e38d8a8340242cb33a5add2b1ff4270b04ed78de
parent b0bb781fc73ef40365e4c996a16f04368d64fc9d
Author: Jinn Koriech <jinn@ixydo.com>
Date: Thu, 24 Apr 2014 15:51:55 +0100
Add flag to disable/enable bookmark sorting
The bookmarks are normally sorted, however with a newly introduced
flag this can be disabled.
Diffstat:
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt
@@ -633,6 +633,9 @@ NERD tree. These options should be set in your vimrc.
|'NERDTreeBookmarksFile'| Where the bookmarks are stored.
+|'NERDTreeBookmarksSort'| Whether the bookmarks list is sorted on
+ display.
+
|'NERDTreeMouseMode'| Tells the NERD tree how to handle mouse
clicks.
@@ -825,6 +828,14 @@ Default: $HOME/.NERDTreeBookmarks
This is where bookmarks are saved. See |NERDTreeBookmarkCommands|.
------------------------------------------------------------------------------
+ *'NERDTreeBookmarksSort'*
+Values: 0 or 1
+Default: 1
+
+If set to 0 then the bookmarks list is not sorted.
+If set to 1 the bookmarks list is sorted.
+
+------------------------------------------------------------------------------
*'NERDTreeMouseMode'*
Values: 1, 2 or 3.
Default: 1.
diff --git a/lib/nerdtree/bookmark.vim b/lib/nerdtree/bookmark.vim
@@ -19,7 +19,9 @@ function! s:Bookmark.AddBookmark(name, path)
endif
endfor
call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path))
- call s:Bookmark.Sort()
+ if g:NERDTreeBookmarksSort ==# 1
+ call s:Bookmark.Sort()
+ endif
endfunction
" FUNCTION: Bookmark.Bookmarks() {{{1
@@ -101,7 +103,9 @@ function! s:Bookmark.CacheBookmarks(silent)
call nerdtree#echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.")
endif
endif
- call s:Bookmark.Sort()
+ if g:NERDTreeBookmarksSort ==# 1
+ call s:Bookmark.Sort()
+ endif
endif
endfunction
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -55,6 +55,7 @@ if !exists("g:NERDTreeIgnore")
let g:NERDTreeIgnore = ['\~$']
endif
call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks')
+call s:initVariable("g:NERDTreeBookmarksSort", 1)
call s:initVariable("g:NERDTreeHighlightCursorline", 1)
call s:initVariable("g:NERDTreeHijackNetrw", 1)
call s:initVariable("g:NERDTreeMouseMode", 1)