From 4547593a6423c8f0c14e01490b6d2f34a5845e02 Mon Sep 17 00:00:00 2001 From: dkt1412 Date: Tue, 11 Jul 2017 23:23:21 -0700 Subject: [PATCH 1/2] Add JumpToMethod function to rtags and map to ro by default. --- plugin/rtags.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugin/rtags.vim b/plugin/rtags.vim index 796e8b70..c2594292 100644 --- a/plugin/rtags.vim +++ b/plugin/rtags.vim @@ -83,6 +83,7 @@ if g:rtagsUseDefaultMappings == 1 noremap rb :call rtags#JumpBack() noremap rC :call rtags#FindSuperClasses() noremap rc :call rtags#FindSubClasses() + noremap ro :call rtags#JumpToMethod(input("Pattern? ", "", "customlist,rtags#CompleteSymbols")) noremap rd :call rtags#Diagnostics() endif @@ -416,6 +417,16 @@ function! rtags#JumpTo(open_opt, ...) endfunction +function! rtags#JumpToMethod(pattern) + let current_file = expand("%") + let args = { + \ '-a' : '', + \ '-F': a:pattern, + \ '--kind-filter': 'CXXMethod', + \ '-i': current_file } + let results = rtags#ExecuteThen(args, [[function('rtags#JumpToHandler'), { 'open_opt' : g:SAME_WINDOW }]]) +endfunction + function! rtags#parseSourceLocation(string) let [location; symbol_detail] = split(a:string, '\s\+') let splittedLine = split(location, ':') From 3206fb2e9476a70122e3365cd57e051956a7acbf Mon Sep 17 00:00:00 2001 From: dkt1412 Date: Tue, 11 Jul 2017 23:28:52 -0700 Subject: [PATCH 2/2] Add docs --- README.md | 1 + doc/rtags.txt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index b353e8af..e827e5eb 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ It is possible to set its maximum size (number of entries), default is 100: | <Leader>rw | -e -r --rename | Rename symbol under cursor | | <Leader>rv | -k -r | Find virtuals | | <Leader>rb | N/A | Jump to previous location | +| <Leader>ro | --kind-filter -i -F | Find method in current file | ## Unite sources diff --git a/doc/rtags.txt b/doc/rtags.txt index 3bf95f5a..3c461edb 100644 --- a/doc/rtags.txt +++ b/doc/rtags.txt @@ -186,6 +186,10 @@ g:rtagsLog *rtags-FindSubClasses* rc Find the subclasses of the class under the cursor. + *rtags-leader-ro* + *rtags-JumpToMethod* + ro Find and jump to method in current file. + *rtags-commands* 5. Commands