Skip to content

Commit c69cb77

Browse files
committed
Fix #1 - Rename local variable with isk include $
When $ is included in iskeyword, current('<cword>') will include $ instead of excluding it, making the rename local variable trying to replace $$oldName by $newName. The fix will make sure to remove any preceding $ in the variable name to be replaced.
1 parent 1c5aa57 commit c69cb77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/php-refactoring-toolbox.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ endfunction
106106
" }}}
107107

108108
function! PhpRenameLocalVariable() " {{{
109-
let l:oldName = expand('<cword>')
109+
let l:oldName = substitute(expand('<cword>'), '^\$*', '', '')
110110
let l:newName = inputdialog('Rename ' . l:oldName . ' to: ')
111111
if s:PhpSearchInCurrentFunction('$' . l:newName . '\>', 'n') > 0
112112
call s:PhpEchoError('$' . l:newName . ' seems to already exist in the current function scope. Replace anyway ?')

0 commit comments

Comments
 (0)