Fix (p)ath not displaying in the minimal menu (#1038)

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 ‘(’
This commit is contained in:
Chris Patuzzo 2019-09-15 19:41:27 +01:00 committed by Phil Runninger
parent 60ec10b477
commit 2eaedd8bf4

View File

@ -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