From 2eaedd8bf403202eeacb363abe2de4753141b00a Mon Sep 17 00:00:00 2001 From: Chris Patuzzo Date: Sun, 15 Sep 2019 19:41:27 +0100 Subject: [PATCH] Fix (p)ath not displaying in the minimal menu (#1038) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ‘copy (p)ath to clipboard’ menu item was added recently in this pull request: https://github.com/scrooloose/nerdtree/pull/1002/files However, this caused the NERDTreeMinimalMenu to display ‘copy’ instead of ‘(p)ath’ because it was simply using the first word of the item’s text. This change fixes that bug by using a regex to pick out the first word beginning with ‘(’ --- lib/nerdtree/menu_controller.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/nerdtree/menu_controller.vim b/lib/nerdtree/menu_controller.vim index 05e82d9..874c09d 100644 --- a/lib/nerdtree/menu_controller.vim +++ b/lib/nerdtree/menu_controller.vim @@ -62,9 +62,10 @@ function! s:MenuController._echoPrompt() if self.isMinimal() let selection = self.menuItems[self.selection].text + let keyword = matchstr(selection, "\([^ ]*") let shortcuts = map(copy(self.menuItems), "v:val['shortcut']") - let shortcuts[self.selection] = " " . split(selection)[0] . " " + let shortcuts[self.selection] = " " . keyword . " " echo "Menu: [" . join(shortcuts, ",") . "] (" . navHelp . " or shortcut): " else