Quickly add blank lines at specified line numbers using vim? -


i know how add blank lines above or below current position of cursor (using o , o) there quick way add blank lines @ arbitrary line numbers? realize original line numbers give no longer accurate after first blank line has been added, e.g. if wanted add blank lines line 5, 10, , 15, after blank line has been added line 5, second blank line should added line 11, , third blank line should added line 17.

edit: can use macro task, i.e qao<esc>q. have still manually move line numbers individually.

here general way add blank lines in specific line number without affecting other lines:

:g/^/if (index([5,10,15],line('.')) != -1)| s//\r/g |endif 

you can add or change items in list [5,10,15] ( inside index() function ). items lines affected.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -