Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a NERDTreeMinimalMenu feature #938

Merged
merged 5 commits into from
Feb 24, 2019
Merged

Add a NERDTreeMinimalMenu feature #938

merged 5 commits into from
Feb 24, 2019

Conversation

tuzz
Copy link
Contributor

@tuzz tuzz commented Jan 21, 2019

Hello, thanks for maintaining a plugin I use all the time. ❤️

One thing I've wanted for a while is a more compact menu that reduces the amount of scrolling in Vim. I think a large portion of people who use NERDTree are already familiar with each of the menu items so this might be a nice addition to reduce noise.

Therefore, I've added a new configuration setting NERDTreeMinimalMenu for this. When this is set, a single-line menu is presented and the follow-up text for each action is presented as a single line, too.

Thanks

menu

tuzz added a commit to tuzz/zz that referenced this pull request Jan 21, 2019
Earlier today I opened a pull request on NERD tree
to add a minimal menu feature:

preservim/nerdtree#938
@PhilRunninger
Copy link
Member

I like this idea. I'm almost tempted to suggest this be the only way to show the menu.

I just merged a PR that caused a conflict to appear in yours. It won't take too much work to resolve it. While you're at it, what do you think of this suggestion? Instead of, or in addition to, an asterisk to mark the current selection, show its full text, something like one of these:

Menu: [(a)dd node /m/d/r/o/q/c/l] (Use j/k/enter or shortcut):
Menu: [a, (m)ove node ,d,r,o,q,c,l] (Use j/k/enter or shortcut):
Menu: [a|m| (d)elete node |r|o|q|c|l] (Use j/k/enter or shortcut):

I think it's important to make sure the j/k/enter option for navigating the menu is visible for those unfamiliar with it. Believe it or not, I didn't notice it until recently myself; I always just used the shortcut.

tuzz added 4 commits February 22, 2019 13:35
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.
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’.
@tuzz
Copy link
Contributor Author

tuzz commented Feb 22, 2019

Hi Phil, thanks for the feedback. I've rebased and updated the menu in this commit.

I played with it a bit and I think this might be the cleanest way to present it. See the commit message for my rationale. What do you think?

minimal-menu

Thanks

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.
@PhilRunninger PhilRunninger merged commit 84737f2 into preservim:master Feb 24, 2019
@PhilRunninger
Copy link
Member

Looks good, @tuzz. Thanks for the addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants