[フレーム]
Last Updated: February 20, 2016
·
4.871K
· wordofchristian

Vim command to convert variable into spec let(:var)

https://github.com/garybernhardt/dotfiles/blob/master/.vimrc

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PROMOTE VARIABLE TO RSPEC LET
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! PromoteToLet()
 :normal! dd
 " :exec '?^\s*it\>'
 :normal! P
 :.s/\(\w\+\) = \(.*\)$/let(:1円) { 2円 }/
 :normal ==
endfunction
:command! PromoteToLet :call PromoteToLet()
:map <leader>p :PromoteToLet<cr>

AltStyle によって変換されたページ (->オリジナル) /