I am using this snippet code (just delete first line with ed
). I wanna know if i can make something like this in vim
. I wrote the script and passed the file as an argument.
file:
# This is a comment #
foo bar
edit with ed
:
ed $1 << EOF
1/^[ ]*$/d
w
q
EOF
I tried with vim
:
vi $1 << EOF
dd
w
q
EOF
> Vim: Warning: Input is not from a terminal
You can start vim in 'ex' mode and feed it the commands:
vim -E -s yourfile <<EOF
:1d
:update
:quit
EOF
But it would be more appropriate just to use sed in this case:
sed '1d' yourfile