mirror of
https://github.com/preservim/nerdtree.git
synced 2025-02-17 06:52:53 +08:00
remove the old api functions
This commit is contained in:
parent
a052a0db65
commit
59257d7a3a
|
@ -949,41 +949,7 @@ This option is used to change the size of the NERD tree when it is loaded.
|
|||
==============================================================================
|
||||
4. Hacking the NERD tree *NERDTreeHacking*
|
||||
|
||||
Public functions ~
|
||||
|
||||
The script provides 2 public functions for your hacking pleasure. Their
|
||||
signatures are: >
|
||||
function! NERDTreeGetCurrentNode()
|
||||
function! NERDTreeGetCurrentPath()
|
||||
<
|
||||
The first returns the node object that the cursor is currently on, while the
|
||||
second returns the corresponding path object.
|
||||
|
||||
This is probably a good time to mention that the script implements prototype
|
||||
style OO. To see the functions that each class provides you can read look at
|
||||
the code.
|
||||
|
||||
Use the node objects to manipulate the structure of the tree. Use the path
|
||||
objects to access the files/directories the tree nodes represent.
|
||||
|
||||
The NERD tree filetype ~
|
||||
|
||||
NERD tree buffers have a filetype of "nerdtree". You can use this to hack the
|
||||
NERD tree via autocommands (on |FileType|) or via an ftplugin.
|
||||
|
||||
For example, putting this code in ~/.vim/ftplugin/nerdtree.vim would override
|
||||
the o mapping, making it open the selected node in a new gvim instance. >
|
||||
|
||||
nnoremap <silent> <buffer> o :call <sid>openInNewVimInstance()<cr>
|
||||
function! s:openInNewVimInstance()
|
||||
let p = NERDTreeGetCurrentPath()
|
||||
if p != {}
|
||||
silent exec "!gvim " . p.strForOS(1) . "&"
|
||||
endif
|
||||
endfunction
|
||||
<
|
||||
This way you can add new mappings or :commands or override any existing
|
||||
mapping.
|
||||
TODO: fill in when new api is complete
|
||||
|
||||
==============================================================================
|
||||
5. About *NERDTreeAbout*
|
||||
|
|
|
@ -2421,46 +2421,6 @@ let g:NERDTreeDirNode = s:TreeDirNode
|
|||
let g:NERDTreeFileNode = s:TreeFileNode
|
||||
let g:NERDTreeBookmark = s:Bookmark
|
||||
|
||||
|
||||
"Returns the node that the cursor is currently on.
|
||||
"
|
||||
"If the cursor is not in the NERDTree window, it is temporarily put there.
|
||||
"
|
||||
"If no NERD tree window exists for the current tab, a NERDTree.NoTreeForTab
|
||||
"exception is thrown.
|
||||
"
|
||||
"If the cursor is not on a node then an empty dictionary {} is returned.
|
||||
function! NERDTreeGetCurrentNode()
|
||||
if !s:treeExistsForTab() || !s:isTreeOpen()
|
||||
throw "NERDTree.NoTreeForTabError: there is no NERD tree open for the current tab"
|
||||
endif
|
||||
|
||||
let winnr = winnr()
|
||||
if winnr != s:getTreeWinNum()
|
||||
call s:putCursorInTreeWin()
|
||||
endif
|
||||
|
||||
let treenode = s:TreeFileNode.GetSelected()
|
||||
|
||||
if winnr != winnr()
|
||||
call s:exec('wincmd w')
|
||||
endif
|
||||
|
||||
return treenode
|
||||
endfunction
|
||||
|
||||
"Returns the path object for the current node.
|
||||
"
|
||||
"Subject to the same conditions as NERDTreeGetCurrentNode
|
||||
function! NERDTreeGetCurrentPath()
|
||||
let node = NERDTreeGetCurrentNode()
|
||||
if node != {}
|
||||
return node.path
|
||||
else
|
||||
return {}
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! NERDTreeAddMenuItem(options)
|
||||
call s:MenuItem.Create(a:options)
|
||||
endfunction
|
||||
|
|
Loading…
Reference in New Issue
Block a user