diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index 1ad8e18..bf1ab5a 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -679,6 +679,9 @@ NERD tree. These options should be set in your vimrc. a buffer when a file is being deleted or renamed via a context menu command. +|'NERDTreeCreatePrefix'| Specify a prefix to be used when creating the + NERDTree window. + ------------------------------------------------------------------------------ 3.2. Customisation details *NERDTreeOptionDetails* @@ -1010,6 +1013,17 @@ option: > let NERDTreeAutoDeleteBuffer=0 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* diff --git a/lib/nerdtree/creator.vim b/lib/nerdtree/creator.vim index 9775d31..8dd6c2c 100644 --- a/lib/nerdtree/creator.vim +++ b/lib/nerdtree/creator.vim @@ -96,7 +96,8 @@ function! s:Creator.createWindowTree(dir) "we need a unique name for each window tree buffer to ensure they are "all independent - exec "silent edit " . self._nextBufferName() + let prefix = get(g:, "NERDTreeCreatePrefix", "silent") + exec prefix . " edit " . self._nextBufferName() call self._createNERDTree(path, "window") let b:NERDTree._previousBuf = bufnr(previousBuf)