tags:

views:

112

answers:

1

According to http://vimdoc.sourceforge.net/htmldoc/usr_41.html#function-list vim script has functions setline() and append() to modify the current buffer but how do i delete a line from within a script? With setline(1, "") the line is only emptied but I want to get rid of it.

+3  A: 

You use the ex command :d. :5d deletes line 5.

jamessan
I'm still a bit puzzled why there is no API function for doing something so important but apart from that'exe ":1," . lastline . "d"'does everything I want (actually I wanted to delete a whole range of lines).
ahe
Because there's no need for a function to do that. You have a command that can do it. Vimscript is a base of all the ex commands normally available plus additional functions to provide functionality that isn't available (or easily available) through the ex commands.
jamessan