diff --git a/plug.vim b/plug.vim index 9dd02c0..6f82c9f 100644 --- a/plug.vim +++ b/plug.vim @@ -2426,8 +2426,13 @@ function! s:diff() \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) if cnts[0] || cnts[1] - nnoremap :silent! call preview_commit() - nnoremap o :silent! call preview_commit() + nnoremap (plug-preview) :silent! call preview_commit() + if empty(maparg("\", 'n')) + nmap (plug-preview) + endif + if empty(maparg('o', 'n')) + nmap o (plug-preview) + endif endif if cnts[0] nnoremap X :call revert() diff --git a/test/workflow.vader b/test/workflow.vader index b0a43a1..d76a13b 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -370,8 +370,15 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff): AssertEqual 1, &previewwindow AssertEqual 'git', &filetype - " Back to plug window - wincmd p + " Close preview window + pclose + + " Open and go to preview window with a custom mapping + nmap (plug-preview)P + execute "normal \" + AssertEqual 1, &previewwindow, 'Should be on preview window' + normal q + AssertEqual 0, &previewwindow, 'Should not be on preview window' " ]] motion execute 'normal $]]'