vim - Inserting text when opening a file -
i trying edit new file vim. first line should given text string. like
vim -c ":insert text" filename.txt the behaviour looking filename.txt opened vim , word text appears on first line.
the command above wrong.. suggestion on how obtain behaviour.
thanks.
convoluted solution:
this seems want. not save file, inserts text.
vim -c ':exe "normal itext"' filename.txt this works same, exits insert mode after text entered:
vim -c ':exe "normal itext\<esc>"' filename.txt previous, incorrect solution. helpful:
similar hal's answer, can have vim grab text standard input:
echo "this text" | vim - -c ":w filename.txt" and vim open "this text" on first line, , -c command call :w filename.txt command vim opens.
Comments
Post a Comment