Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing a line from the buffer in a vim script

Tags:

vim

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.

like image 639
ahe Avatar asked Mar 27 '10 22:03

ahe


2 Answers

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

like image 78
jamessan Avatar answered Oct 26 '22 22:10

jamessan


@ahe
1delete
%delete
1,$delete

no need for execute here

like image 22
dzikie węże Avatar answered Oct 26 '22 22:10

dzikie węże