Merge pull request #550 from wincent/keepalt

Make window creation command configurable
This commit is contained in:
Martin Grenfell 2016-04-26 09:05:57 +01:00
commit 0cb999c070
2 changed files with 16 additions and 1 deletions

View File

@ -679,6 +679,9 @@ NERD tree. These options should be set in your vimrc.
a buffer when a file is being deleted or renamed a buffer when a file is being deleted or renamed
via a context menu command. via a context menu command.
|'NERDTreeCreatePrefix'| Specify a prefix to be used when creating the
NERDTree window.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
3.2. Customisation details *NERDTreeOptionDetails* 3.2. Customisation details *NERDTreeOptionDetails*
@ -1010,6 +1013,17 @@ option: >
let NERDTreeAutoDeleteBuffer=0 let NERDTreeAutoDeleteBuffer=0
let NERDTreeAutoDeleteBuffer=1 let NERDTreeAutoDeleteBuffer=1
< <
------------------------------------------------------------------------------
*'NERDTreeCreatePrefix'*
Values: Any valid command prefix.
Default: "silent".
Internally, NERDTree uses the |:edit| command to create a buffer in which to
display its tree view. You can augment this behavior by specifying a prefix
string such as "keepalt" or similar. For example, to have NERDTree create its
tree window using `silent keepalt keepjumps edit`:
let NERDTreeCreatePrefix='silent keepalt keepjumps'
<
============================================================================== ==============================================================================
4. The NERD tree API *NERDTreeAPI* 4. The NERD tree API *NERDTreeAPI*

View File

@ -96,7 +96,8 @@ function! s:Creator.createWindowTree(dir)
"we need a unique name for each window tree buffer to ensure they are "we need a unique name for each window tree buffer to ensure they are
"all independent "all independent
exec "silent edit " . self._nextBufferName() let prefix = get(g:, "NERDTreeCreatePrefix", "silent")
exec prefix . " edit " . self._nextBufferName()
call self._createNERDTree(path, "window") call self._createNERDTree(path, "window")
let b:NERDTree._previousBuf = bufnr(previousBuf) let b:NERDTree._previousBuf = bufnr(previousBuf)