mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
update the doc for the new key api functionality
This commit is contained in:
@@ -991,22 +991,32 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
|
|||||||
"quickhelpText" - the text that will appear in the quickhelp (see
|
"quickhelpText" - the text that will appear in the quickhelp (see
|
||||||
|NERDTree-?|)
|
|NERDTree-?|)
|
||||||
|
|
||||||
|
Additionally, a "scope" argument may be supplied. This constrains the
|
||||||
|
mapping so that it is only activated if the cursor is on a certain object.
|
||||||
|
That object is then passed into the handling method. Possible values are:
|
||||||
|
"FileNode" - a file node
|
||||||
|
"DirNode" - a directory node
|
||||||
|
"Node" - a file or directory node
|
||||||
|
"Bookmark" - A bookmark
|
||||||
|
"all" - the keymap is not constrained to any scope (default). When
|
||||||
|
thei is used, the handling function is not passed any arguments.
|
||||||
|
|
||||||
|
|
||||||
Example: >
|
Example: >
|
||||||
call NERDTreeAddKeyMap({
|
call NERDTreeAddKeyMap({
|
||||||
\ 'key': 'b',
|
\ 'key': 'foo',
|
||||||
\ 'callback': 'NERDTreeEchoCurrentNode',
|
\ 'callback': 'NERDTreeCDHandler',
|
||||||
\ 'quickhelpText': 'echo full path of current node' })
|
\ 'quickhelpText': 'echo full path of current node' })
|
||||||
|
\ 'scope': 'DirNode'
|
||||||
|
|
||||||
function! NERDTreeEchoCurrentNode()
|
function! NERDTreeCDHandler(dirnode)
|
||||||
let n = g:NERDTreeFileNode.GetSelected()
|
call a:dirnode.changeToDir()
|
||||||
if n != {}
|
|
||||||
echomsg 'Current node: ' . n.path.str()
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
||||||
It adds a (rather useless) mapping on 'b' which echos the full path to the
|
It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of
|
||||||
current node.
|
the current dir node. Note this mapping will only fire when the cursor is
|
||||||
|
on a directory node.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.2. Menu API *NERDTreeMenuAPI*
|
4.2. Menu API *NERDTreeMenuAPI*
|
||||||
@@ -1116,6 +1126,9 @@ The latest dev versions are on github
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
6. Changelog *NERDTreeChangelog*
|
6. Changelog *NERDTreeChangelog*
|
||||||
|
|
||||||
|
Next
|
||||||
|
- add 'scope' argument to the key map API
|
||||||
|
|
||||||
4.2.0
|
4.2.0
|
||||||
- Add NERDTreeDirArrows option to make the UI use pretty arrow chars
|
- Add NERDTreeDirArrows option to make the UI use pretty arrow chars
|
||||||
instead of the old +~| chars to define the tree structure (sickill)
|
instead of the old +~| chars to define the tree structure (sickill)
|
||||||
|
|||||||
Reference in New Issue
Block a user