Skip to content

Commit b23d8d7

Browse files
committed
Only include = in cursor word for methods
1 parent 25a5188 commit b23d8d7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ftplugin/ruby.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,13 @@ function! RubyCursorIdentifier() abort
339339
let asciicode = '\%(\w\|[]})\"'."'".']\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)'
340340
let number = '\%(\%(\w\|[]})\"'."'".']\s*\)\@<!-\)\=\%(\<[[:digit:]_]\+\%(\.[[:digit:]_]\+\)\=\%([Ee][[:digit:]_]\+\)\=\>\|\<0[xXbBoOdD][[:xdigit:]_]\+\>\)\|'.asciicode
341341
let operator = '\%(\[\]\|<<\|<=>\|[!<>]=\=\|===\=\|[!=]\~\|>>\|\*\*\|\.\.\.\=\|=>\|[~^&|*/%+-]\)'
342-
let method = '\%(\<[_a-zA-Z]\w*\>\%([?!]\|\s*=>\@!\)\=\)'
342+
let method = '\%(\.[_a-zA-Z]\w*\s*=>\@!\|\<[_a-zA-Z]\w*\>[?!]\=\)'
343343
let global = '$\%([!$&"'."'".'*+,./:;<=>?@\`~]\|-\=\w\+\>\)'
344344
let symbolizable = '\%(\%(@@\=\)\w\+\>\|'.global.'\|'.method.'\|'.operator.'\)'
345345
let pattern = '\C\s*\%('.number.'\|\%(:\@<!:\)\='.symbolizable.'\)'
346346
let [lnum, col] = searchpos(pattern,'bcn',line('.'))
347347
let raw = matchstr(getline('.')[col-1 : ],pattern)
348-
let stripped = substitute(substitute(raw,'\s\+=$','=',''),'^\s*:\=','','')
348+
let stripped = substitute(substitute(raw,'\s\+=$','=',''),'^\s*[:.]\=','','')
349349
return stripped == '' ? expand("<cword>") : stripped
350350
endfunction
351351

0 commit comments

Comments
 (0)