mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -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
|
"SECTION: Script level variable declaration{{{2
|
||||||
let s:escape_chars = " \\`\|\"#%&,?()\*^<>"
|
let s:escape_chars = " \\`\|\"#%&,?()\*^<>"
|
||||||
let s:NERDTreeBufName = '_NERD_tree_'
|
let s:NERDTreeBufName = 'NERD_tree_'
|
||||||
|
|
||||||
let s:tree_wid = 2
|
let s:tree_wid = 2
|
||||||
let s:tree_markup_reg = '^[ `|]*[\-+~]'
|
let s:tree_markup_reg = '^[ `|]*[\-+~]'
|
||||||
@@ -141,6 +141,9 @@ if s:running_windows
|
|||||||
let s:os_slash = '\'
|
let s:os_slash = '\'
|
||||||
endif
|
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
|
" SECTION: Commands {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
"init the command that users start the nerd tree with
|
"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 splitLocation = g:NERDTreeWinPos == "left" ? "topleft " : "botright "
|
||||||
let splitSize = g:NERDTreeWinSize
|
let splitSize = g:NERDTreeWinSize
|
||||||
if !exists('t:NERDTreeBufName')
|
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
|
endif
|
||||||
let cmd = splitLocation . 'vertical ' . splitSize . ' new ' . t:NERDTreeBufName
|
let cmd = splitLocation . 'vertical ' . splitSize . ' new ' . t:NERDTreeBufName
|
||||||
silent! execute cmd
|
silent! execute cmd
|
||||||
|
|||||||
Reference in New Issue
Block a user