diff --git a/README.md b/README.md index 1ec589ea..fd310e15 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,11 @@ default mappings can be disabled: let g:rtagsUseDefaultMappings = 0 +Define custom mappings prefix: + let g:rtagsLeader +default: + 'r' + By default, search results are showed in a location list. Location lists are local to the current window. To use the vim QuickFix window, which is shared between all windows, set: diff --git a/doc/rtags.txt b/doc/rtags.txt index abc7f026..a816dab6 100644 --- a/doc/rtags.txt +++ b/doc/rtags.txt @@ -79,6 +79,11 @@ g:rtagsUseDefaultMappings Otherwise, no mappings are set up and custom mappings can be configured by a user. + *g:rtagsLeader* +g:rtagsLeader + Default: 'r' + If you want to custom mappings prefix, set it. + *g:rtagsMinCharsForCommandCompletion* *rtags-variable-min-chars-for-cmd-compl* g:rtagsMinCharsForCommandCompletion diff --git a/plugin/rtags.vim b/plugin/rtags.vim index ebcaa5f8..b83fa0f1 100644 --- a/plugin/rtags.vim +++ b/plugin/rtags.vim @@ -76,26 +76,31 @@ let s:LOC_OPEN_OPTS = { \ g:NEW_TAB : 'tab' \ } +if !exists("g:rtagsLeader") + let g:rtagsLeader = 'r' +endif +exec 'map ' . g:rtagsLeader . ' (rtags-prefix)' + if g:rtagsUseDefaultMappings == 1 - noremap ri :call rtags#SymbolInfo() - noremap rj :call rtags#JumpTo(g:SAME_WINDOW) - noremap rJ :call rtags#JumpTo(g:SAME_WINDOW, { '--declaration-only' : '' }) - noremap rS :call rtags#JumpTo(g:H_SPLIT) - noremap rV :call rtags#JumpTo(g:V_SPLIT) - noremap rT :call rtags#JumpTo(g:NEW_TAB) - noremap rp :call rtags#JumpToParent() - noremap rf :call rtags#FindRefs() - noremap rF :call rtags#FindRefsCallTree() - noremap rn :call rtags#FindRefsByName(input("Pattern? ", "", "customlist,rtags#CompleteSymbols")) - noremap rs :call rtags#FindSymbols(input("Pattern? ", "", "customlist,rtags#CompleteSymbols")) - noremap rr :call rtags#ReindexFile() - noremap rl :call rtags#ProjectList() - noremap rw :call rtags#RenameSymbolUnderCursor() - noremap rv :call rtags#FindVirtuals() - noremap rb :call rtags#JumpBack() - noremap rC :call rtags#FindSuperClasses() - noremap rc :call rtags#FindSubClasses() - noremap rd :call rtags#Diagnostics() + noremap (rtags-prefix)i :call rtags#SymbolInfo() + noremap (rtags-prefix)j :call rtags#JumpTo(g:SAME_WINDOW) + noremap (rtags-prefix)J :call rtags#JumpTo(g:SAME_WINDOW, { '--declaration-only' : '' }) + noremap (rtags-prefix)S :call rtags#JumpTo(g:H_SPLIT) + noremap (rtags-prefix)V :call rtags#JumpTo(g:V_SPLIT) + noremap (rtags-prefix)T :call rtags#JumpTo(g:NEW_TAB) + noremap (rtags-prefix)p :call rtags#JumpToParent() + noremap (rtags-prefix)f :call rtags#FindRefs() + noremap (rtags-prefix)F :call rtags#FindRefsCallTree() + noremap (rtags-prefix)n :call rtags#FindRefsByName(input("Pattern? ", "", "customlist,rtags#CompleteSymbols")) + noremap (rtags-prefix)s :call rtags#FindSymbols(input("Pattern? ", "", "customlist,rtags#CompleteSymbols")) + noremap (rtags-prefix)r :call rtags#ReindexFile() + noremap (rtags-prefix)l :call rtags#ProjectList() + noremap (rtags-prefix)w :call rtags#RenameSymbolUnderCursor() + noremap (rtags-prefix)v :call rtags#FindVirtuals() + noremap (rtags-prefix)b :call rtags#JumpBack() + noremap (rtags-prefix)C :call rtags#FindSuperClasses() + noremap (rtags-prefix)c :call rtags#FindSubClasses() + noremap (rtags-prefix)d :call rtags#Diagnostics() endif let s:script_folder_path = escape( expand( ':p:h' ), '\' )