From 6da96cde1dd5bd362f88565bac818240244ee8e0 Mon Sep 17 00:00:00 2001 From: mg979 Date: Thu, 6 Sep 2018 02:20:07 +0200 Subject: [PATCH 1/3] Use mapcheck() instead of maparg() --- plugin/vinegar.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/vinegar.vim b/plugin/vinegar.vim index 168b09a..06ec0ad 100644 --- a/plugin/vinegar.vim +++ b/plugin/vinegar.vim @@ -28,7 +28,7 @@ endif unlet! s:netrw_up nnoremap VinegarUp :call opendir('edit') -if empty(maparg('-', 'n')) +if empty(mapcheck('-', 'n')) nmap - VinegarUp endif From 2aba864faa7dd64dbbb366cdeabbcdd3891ff116 Mon Sep 17 00:00:00 2001 From: mg979 Date: Thu, 6 Sep 2018 11:40:11 +0200 Subject: [PATCH 2/3] Update doc with plugs --- doc/vinegar.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/vinegar.txt b/doc/vinegar.txt index 44d419e..0798487 100644 --- a/doc/vinegar.txt +++ b/doc/vinegar.txt @@ -13,7 +13,13 @@ MAPPINGS *vinegar-mappings* *vinegar--* - Open the parent directory of the current file. This is the only mapping available outside of netrw - buffers. + buffers. If you have already mapped - to somthing else, + you'll need to map one of these plugs: + + VinegarUp + VinegarTabUp + VinegarSplitUp + VinegarVerticalSplitUp *vinegar-~* ~ Open $HOME. From 78648e670c76411b6ededa12c9da7104cb062d7c Mon Sep 17 00:00:00 2001 From: mg979 Date: Thu, 6 Sep 2018 11:44:00 +0200 Subject: [PATCH 3/3] Check both '-' and plugs --- plugin/vinegar.vim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugin/vinegar.vim b/plugin/vinegar.vim index 06ec0ad..7fdd60f 100644 --- a/plugin/vinegar.vim +++ b/plugin/vinegar.vim @@ -28,14 +28,17 @@ endif unlet! s:netrw_up nnoremap VinegarUp :call opendir('edit') -if empty(mapcheck('-', 'n')) - nmap - VinegarUp -endif - nnoremap VinegarTabUp :call opendir('tabedit') nnoremap VinegarSplitUp :call opendir('split') nnoremap VinegarVerticalSplitUp :call opendir('vsplit') +if empty(mapcheck('-', 'n')) && !hasmapto('VinegarUp') && + \ !hasmapto('VinegarSplitUp') && + \ !hasmapto('VinegarVerticalSplitUp') && + \ !hasmapto('VinegarTabUp') + nmap - VinegarUp +endif + function! s:opendir(cmd) abort let df = ','.s:dotfiles if expand('%:t')[0] ==# '.' && g:netrw_list_hide[-strlen(df):-1] ==# df