mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Fix the scope of several key mappings (#1151)
* Limit opening or previewing into a split window to only file nodes. * Prevent previwing directory nodes, which would create another NERDTree. * Refactor the previewBookmark code to open directories a better way. * Update version number in change log. * Update documentation.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
#### 6.9
|
#### 6.9
|
||||||
|
- **.2**: Fix the scope of several key mappings (lifecrisis, PhilRunninger) [#1151](https://github.com/preservim/nerdtree/pull/1151)
|
||||||
- **.0**: Enable opening bookmarks in split windows. (PhilRunninger) [#1144](https://github.com/preservim/nerdtree/pull/1144)
|
- **.0**: Enable opening bookmarks in split windows. (PhilRunninger) [#1144](https://github.com/preservim/nerdtree/pull/1144)
|
||||||
#### 6.8
|
#### 6.8
|
||||||
- **.0**: Allow concealed characters to show another character. (PhilRunninger) [#1138](https://github.com/preservim/nerdtree/pull/1138)
|
- **.0**: Allow concealed characters to show another character. (PhilRunninger) [#1138](https://github.com/preservim/nerdtree/pull/1138)
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
|
|||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Node', 'callback': s.'openHSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'FileNode', 'callback': s.'openHSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Node', 'callback': s.'openVSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'FileNode', 'callback': s.'openVSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Node', 'callback': s.'previewNodeCurrent' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'FileNode', 'callback': s.'previewNodeCurrent' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Node', 'callback': s.'previewNodeHSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'FileNode', 'callback': s.'previewNodeHSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Node', 'callback': s.'previewNodeVSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'FileNode', 'callback': s.'previewNodeVSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
|
||||||
@@ -564,11 +564,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
||||||
function! s:previewBookmark(bookmark) abort
|
function! s:previewBookmark(bookmark) abort
|
||||||
if a:bookmark.path.isDirectory
|
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
||||||
execute 'NERDTreeFind '.a:bookmark.path.str()
|
|
||||||
else
|
|
||||||
call a:bookmark.activate(b:NERDTree, {'stay': 1, 'where': 'p', 'keepopen': 1})
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
||||||
|
|||||||
@@ -318,9 +318,8 @@ Applies to: files.
|
|||||||
If a file node or a bookmark that links to a file is selected, it is opened in
|
If a file node or a bookmark that links to a file is selected, it is opened in
|
||||||
the previous window, but the cursor does not move.
|
the previous window, but the cursor does not move.
|
||||||
|
|
||||||
If a bookmark that links to a directory is selected, that directory is found
|
If a bookmark that links to a directory is selected then that directory
|
||||||
in the current NERDTree. If the directory couldn't be found, a new NERDTree is
|
becomes the new root.
|
||||||
created.
|
|
||||||
|
|
||||||
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|
||||||
|NERDTree-o|).
|
|NERDTree-o|).
|
||||||
@@ -359,7 +358,7 @@ window.
|
|||||||
*NERDTree-gi*
|
*NERDTree-gi*
|
||||||
Default key: gi
|
Default key: gi
|
||||||
Map setting: *NERDTreeMapPreviewSplit*
|
Map setting: *NERDTreeMapPreviewSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
The same as |NERDTree-i| except that the cursor is not moved.
|
The same as |NERDTree-i| except that the cursor is not moved.
|
||||||
|
|
||||||
@@ -379,7 +378,7 @@ in the new window.
|
|||||||
*NERDTree-gs*
|
*NERDTree-gs*
|
||||||
Default key: gs
|
Default key: gs
|
||||||
Map setting: *NERDTreeMapPreviewVSplit*
|
Map setting: *NERDTreeMapPreviewVSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
The same as |NERDTree-s| except that the cursor is not moved.
|
The same as |NERDTree-s| except that the cursor is not moved.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user