diff --git a/README.md b/README.md index 46078e1..81981c1 100644 --- a/README.md +++ b/README.md @@ -73,16 +73,16 @@ You can change the shortcuts as you like, just read on... You can overwrite any of the default mappings. Just put the following into your `~/.vimrc` and adjust as you like: ```viml -nmap BookmarkToggle -nmap i BookmarkAnnotate -nmap a BookmarkShowAll -nmap j BookmarkNext -nmap k BookmarkPrev -nmap c BookmarkClear -nmap x BookmarkClearAll -nmap kk BookmarkMoveUp -nmap jj BookmarkMoveDown -nmap g BookmarkMoveToLine +nmap (BookmarkToggle) +nmap i (BookmarkAnnotate) +nmap a (BookmarkShowAll) +nmap j (BookmarkNext) +nmap k (BookmarkPrev) +nmap c (BookmarkClear) +nmap x (BookmarkClearAll) +nmap kk (BookmarkMoveUp) +nmap jj (BookmarkMoveDown) +nmap g (BookmarkMoveToLine) ``` You can disable all default key bindings by setting the following in your `~/.vimrc`: diff --git a/doc/bookmarks.txt b/doc/bookmarks.txt index a9c81d9..dea25cd 100644 --- a/doc/bookmarks.txt +++ b/doc/bookmarks.txt @@ -167,18 +167,18 @@ KEY MAPPINGS To change the default keys: > - nmap BookmarkToggle - nmap i BookmarkAnnotate - nmap a BookmarkShowAll - nmap j BookmarkNext - nmap k BookmarkPrev - nmap c BookmarkClear - nmap x BookmarkClearAll + nmap (BookmarkToggle) + nmap i (BookmarkAnnotate) + nmap a (BookmarkShowAll) + nmap j (BookmarkNext) + nmap k (BookmarkPrev) + nmap c (BookmarkClear) + nmap x (BookmarkClearAll) " these will also work with a [count] prefix - nmap kk BookmarkMoveUp - nmap jj BookmarkMoveDown - nmap g BookmarkMoveToLine + nmap kk (BookmarkMoveUp) + nmap jj (BookmarkMoveDown) + nmap g (BookmarkMoveToLine) < To prevent any default mappings from being created (default: 0): @@ -319,16 +319,16 @@ ctrlp.vim is a Full path fuzzy file, buffer, mru, tag, ... finder for Vim. Additionally, when showing all your bookmarks, CtrlP is detected and the plugin will open *:CtrlPBookmark* instead of Vim's quickfix window. Note that -|g:bookmark_auto_close| is no longer applied. Once opened, the window is managed +|g:bookmark_auto_close| is no longer applied. Once opened, the window is managed by CtrlP. -With the CtrlP interface, when you select bookmarks, you can perform the +With the CtrlP interface, when you select bookmarks, you can perform the following actions: * Open the selected bookmarks in various ways (open to the right, open above, open in new tab, etc.) * And more... - + For more information about CtrlP start reading |CtrlP@en|. https://github.com/ctrlpvim/ctrlp.vim diff --git a/plugin/bookmark.vim b/plugin/bookmark.vim index 9c4e776..4cf302e 100644 --- a/plugin/bookmark.vim +++ b/plugin/bookmark.vim @@ -174,7 +174,7 @@ function! BookmarkPrev() endfunction command! PrevBookmark call CallDeprecatedCommand('BookmarkPrev') command! BookmarkPrev call BookmarkPrev() -command! CtrlPBookmark call ctrlp#init(ctrlp#bookmarks#id()) +command! CtrlPBookmark call ctrlp#init(ctrlp#bookmarks#id()) function! BookmarkShowAll() if s:is_quickfix_win() @@ -560,15 +560,20 @@ endfunction " Maps {{{ function! s:register_mapping(command, shortcut, has_count) + if get(g:, 'bookmark_use_old_plug_key_names', 0) + let command_plug_name = a:command + else + let command_plug_name = "(" . a:command . ")" + endif if a:has_count - execute "nnoremap ". a:command ." :". a:command ." v:count" + execute "nnoremap ". command_plug_name ." :". a:command ." v:count" else - execute "nnoremap ". a:command ." :". a:command ."" + execute "nnoremap ". command_plug_name ." :". a:command ."" endif - if !hasmapto("". a:command) + if !hasmapto("". command_plug_name) \ && !get(g:, 'bookmark_no_default_key_mappings', 0) \ && maparg(a:shortcut, 'n') ==# '' - execute "nmap ". a:shortcut ." ". a:command + execute "nmap ". a:shortcut ." ". command_plug_name endif endfunction