Skip to content

Instantly share code, notes, and snippets.

@kulesa
Created October 16, 2012 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kulesa/3898499 to your computer and use it in GitHub Desktop.
Save kulesa/3898499 to your computer and use it in GitHub Desktop.
vim: promote variable to rspec let
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment