mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
change the way nerd tree buffers are named
Use a sequential numbering system instead of timestamps. This makes the buffer names shorter and neater and easier on the eye when using :NERDTreeMirror
This commit is contained in:
@@ -130,7 +130,7 @@ call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
|
||||
|
||||
"SECTION: Script level variable declaration{{{2
|
||||
let s:escape_chars = " \\`\|\"#%&,?()\*^<>"
|
||||
let s:NERDTreeBufName = '_NERD_tree_'
|
||||
let s:NERDTreeBufName = 'NERD_tree_'
|
||||
|
||||
let s:tree_wid = 2
|
||||
let s:tree_markup_reg = '^[ `|]*[\-+~]'
|
||||
@@ -141,6 +141,9 @@ if s:running_windows
|
||||
let s:os_slash = '\'
|
||||
endif
|
||||
|
||||
"the number to add to the nerd tree buffer name to make the buf name unique
|
||||
let s:next_buffer_number = 1
|
||||
|
||||
" SECTION: Commands {{{1
|
||||
"============================================================
|
||||
"init the command that users start the nerd tree with
|
||||
@@ -1980,7 +1983,8 @@ function! s:createTreeWin()
|
||||
let splitLocation = g:NERDTreeWinPos == "left" ? "topleft " : "botright "
|
||||
let splitSize = g:NERDTreeWinSize
|
||||
if !exists('t:NERDTreeBufName')
|
||||
let t:NERDTreeBufName = localtime() . s:NERDTreeBufName
|
||||
let t:NERDTreeBufName = s:NERDTreeBufName . s:next_buffer_number
|
||||
let s:next_buffer_number += 1
|
||||
endif
|
||||
let cmd = splitLocation . 'vertical ' . splitSize . ' new ' . t:NERDTreeBufName
|
||||
silent! execute cmd
|
||||
|
||||
Reference in New Issue
Block a user