here-document delete first line from file with vim like ed

Зел*_*ный 1 vim bash ed

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
Run Code Online (Sandbox Code Playgroud)

edit with ed:

ed $1 << EOF
1/^[ ]*$/d
w 
q
EOF
Run Code Online (Sandbox Code Playgroud)

I tried with vim:

vi $1 << EOF
dd
w 
q
EOF

> Vim: Warning: Input is not from a terminal
Run Code Online (Sandbox Code Playgroud)

小智 6

You can start vim in 'ex' mode and feed it the commands:

vim -E -s yourfile <<EOF
:1d
:update
:quit
EOF
Run Code Online (Sandbox Code Playgroud)

But it would be more appropriate just to use sed in this case:

sed '1d' yourfile
Run Code Online (Sandbox Code Playgroud)