coffeescript - vimscript insert string before a search pattern -
coffeescript - vimscript insert string before a search pattern -
im write coffeescript refactore plugin.
currently i'am experimenting issue, when seek add together parameter function.
so far in can do
#my code -> # after phone call vim function (new_param) ->
but when want insert before arrow like
#my code foo -> # want foo (new_param) ->
i have unwanted result
(new_param) foo ->
what utilize in vim script is
exec "?->" execute "normal i(new_param) \<esc>"
what should insert before arrow. read searchpos()
don't find illustration understand how work.
know cursor position of import guess handel corner case like
(old_param) -> #add parameter existing parameter (old_param, new_param) ->
this command :
%s/\s\?[-=]>/ (new_param)&/g
will transform:
foo -> foo =>
into:
foo (new_param) -> foo (new_param) =>
for adding new_param case:
you :
%s/)\s\?[-=]>/, new_param&/g
coffeescript vim
Comments
Post a Comment