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 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, ':')