Paste command skipped in vim script to move selection of lines to end of file? -
i'm trying script simple set of vim commands, , can use sequence of commands interactively want. example, given following file contents
#if 0 #include "foo.h" #include "goo.h" <<< here >>> b c #endif
when positioned on line 'a', after #include lines, can do:
:,/endif/-1 d :$ :p :w
however, when put these commands in file ('a_vim_script'), , run:
:source a_vim_script
vim reports:
3 fewer lines "f" 5l, 68c written press enter or type command continue
and produces:
#if 0 #include "foo.h" #include "goo.h" #endif
instead of when these commands interactively:
#if 0 #include "foo.h" #include "goo.h" #endif b c
the delete, move , write commands execute, paste gets skipped mysteriously?
i can task other ways. example, script want (and moves next selection in vim -q list) :
:,$!echo '\#endif\n' && grep -v '\#endif' :w :cn
however, why 'p' paste command in first little vim script gets skipped?
:p
not short :put
short :print
. please use :put
or :pu
short.
additionally should using :move
command instead of :delete
, :put
.
:,/endif/-m $
for more information see:
:h :p :h :pu :h :m
Comments
Post a Comment