Commit c437b9e
Changed files (1)
vimrc
@@ -146,7 +146,7 @@ function! InlineTemp()
normal $"byaW
normal dd
normal vip
- exec ':%s/' . @a . '/' . @b . '/'
+ exec ":'<,'>s/" . @a . '/' . @b . '/'
exec "normal \<Esc>"
call setpos(".", cursor_position)
endfunction
@@ -163,6 +163,14 @@ function! ExtractLet()
normal jw
endfunction
+function! RenameVariable()
+ let cursor_position = getpos(".")
+ let name = input("new name: ")
+ normal "ayiw
+ exec ":.,/end/ s/" . @a . '/' . name . '/'
+ call setpos(".", cursor_position)
+endfunction
+
" }}}}
"" File type-specific settings {{{{
@@ -231,6 +239,7 @@ command! KillWhitespace :normal :%s/ *$//g<cr><c-o><cr>
command! RAddParameter call AddParameter()
command! RInlineTemp call InlineTemp()
command! RExtractLet call ExtractLet()
+command! RRenameVariable call RenameVariable()
" }}}
@@ -357,6 +366,7 @@ nnoremap <leader>T :!ctags -f tags -R<cr>
nnoremap <leader>rap :RAddParameter<cr>
nnoremap <leader>rit :RInlineTemp<cr>
nnoremap <leader>rel :RExtractLet<cr>
+nnoremap <leader>rrlv :RRenameVariable<cr>
" tagbar
nnoremap <leader>tb :TagbarToggle<cr>