From 119610c6b3ed17c4caa569d2e6ca7e6263b00c5f Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 21 May 2019 11:56:00 +0200 Subject: [PATCH] Improve Ruby search commands in vim --- vimrc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vimrc b/vimrc index b611bbc..6e65e63 100644 --- a/vimrc +++ b/vimrc @@ -795,12 +795,11 @@ au BufNewFile,BufRead *.rb :call init_ruby_file() function! s:init_ruby_file() set makeprg=ruby\ -wc\ % setl number - command! -buffer Methods lex MatchingLines("^\\s*def\\>\\s\\+\\zs.*$") | lopen - command! -buffer Functions Methods " Alias - command! -buffer Classes lex MatchingLines("^\\s*class\\>\\s\\+\\zs.*$") | lopen - command! -buffer Modules lex MatchingLines("^\\s*module\\>\\s\\+\\zs.*$") | lopen - command! -buffer Members lex MatchingLines("@\\<\\i*\\>") | lopen - command! -buffer Requires lex MatchingLines("^\\s*require\\(_relative\\)\\?\\>\\s\\+\\zs.*$") | lopen + command! -buffer Methods call setloclist(0, MatchingLinesDict("^\\s*def\\>\\s\\+\\zs.*$")) + command! -buffer Classes call setloclist(0, MatchingLinesDict("^\\s*class\\>\\s\\+\\zs.*$")) + command! -buffer Modules call setloclist(0, MatchingLinesDict("^\\s*module\\>\\s\\+\\zs.*$")) + command! -buffer Members call setloclist(0, MatchingLinesDict("@\\<\\i*\\>")) + command! -buffer Requires call setloclist(0, MatchingLinesDict("^\\s*require\\(_relative\\)\\?\\>\\s\\+\\zs.*$")) nnoremap ic oclass m'end`'a nnoremap id odef m'()end`'a