mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-10 20:33:50 -05:00
Add a NERDTreeMinimalMenu feature (#938)
* Extract the menu action prompts to a function * Add a NERDTreeMinimalMenu configuration option If this option is set, Vim’s command line displays a single-line version of the menu: Which action? (a*/m/d/r/o/q/c/l): Pressing ‘a’ will call the ‘add child node’ menu item as that is its shortcut. The * denotes the position of the currently selected menu item which can be changed with NERDTreeMenuDown and Up in the usual way. The user may wish to set these to <left>, <right> or h, l if they prefer. * Minimise the text once a menu item is chosen If NERDTreeMinimalMenu is set, then echo a single line prompt after the menu item is chosen. This reduces noise for users who are already familiar with how the menu works and prevents Vim scrolling down to accommodate the menu text. If the directory is non-empty we display ‘Delete directory?’ instead of ‘Delete?’ and the user must still type ‘yes’ to confirm, rather than just pressing ‘y’. * Document the new NERDTreeMinimalMenu feature * Tweak the format for the minimal menu prompt As per @PhilRunninger’s suggestions: - The menu now shows the ‘j/k/enter’ help text - The first word of the selected item is shown* - Use commas between menu items so that it’s visually distinct from the ‘j/k/enter’ text * I tried displaying the full menuItem text, but this can be quite long, e.g. > (o)pen the current node with system editor This causes the menu to jump around a lot. We could add another minimal versions of these, but I think the first word seems ok for now.
This commit is contained in:
committed by
Phil Runninger
parent
b6cde142dd
commit
84737f2ebe
@@ -719,6 +719,9 @@ the NERD tree. These settings should be set in your vimrc, using `:let`.
|
||||
|NERDTreeMinimalUI| Disables display of the 'Bookmarks' label and
|
||||
'Press ? for help' text.
|
||||
|
||||
|NERDTreeMinimalMenu| Use a compact menu that fits on a single line
|
||||
for adding, copying, deleting, etc
|
||||
|
||||
|NERDTreeCascadeSingleChildDir|
|
||||
Collapses on the same line directories that have
|
||||
only one child directory.
|
||||
@@ -1116,6 +1119,26 @@ of the following lines for this setting: >
|
||||
let NERDTreeMinimalUI=1
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTreeMinimalMenu*
|
||||
Values: 0 or 1
|
||||
Default: 0
|
||||
|
||||
This setting makes NERD tree use a smaller, more compact menu for adding,
|
||||
copying, deleting nodes. This menu fits on a single line so Vim doesn't need to
|
||||
scroll down to present it. This setting is recommended for users already
|
||||
familiar with the menu items. It will look similar to this:
|
||||
|
||||
Menu: [ (a)dd ,m,d,r,o,q,c,l] (Use j/k/enter or shortcut):
|
||||
|
||||
An action can be selected with its shortcut key or with the NERDTreeMenuUp and
|
||||
NERDTreeMenuDown keys, then pressing enter.
|
||||
|
||||
Use one of the following lines for this setting: >
|
||||
let NERDTreeMinimalMenu=0
|
||||
let NERDTreeMinimalMenu=1
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTreeCascadeSingleChildDir*
|
||||
Values: 0 or 1
|
||||
|
||||
Reference in New Issue
Block a user