sql - How to pipe visually selected text to a UNIX command and append output to current buffer in Vim -
using vim, i'm trying pipe text selected in visual mode unix command , have output appended end of current file. example, have sql command such as:
select * mytable;
i want following:
<esc> v " select text :'<,'>!mysql -uuser -ppass mydb
but instead of having output overwrite selected text, have output appended end of file. see going. i'm working on using vim simple sql editor. way, don't have leave vim edit, tweak, test sql code.
how copying selected text end of file, select copy , run command? if not want repeat same commands on , on again, can record sequence using q
or add new command. have tried latter follows:
:com -range c <line1>,<line2>yank | $ | put | .,$ !rev
with can select lines , type :c
. first yank selection, go end of file, paste yanked text , run command (rev
in case) on new text.
Comments
Post a Comment