Prepend new vim buffer with 2 new lines

2

I am using vim from mutt to reply to my emails and in the .muttrc I have the follow specified:

set editor= 'vim +1 -c "set textwidth=72" -c "set wrap" -c "set nocp" -c "set spell"'

I want to be able to add 2 new lines on top of the reply buffer so that I don't have to add them to every new reply.

So how do I prepend a new buffer from the launch options/commands?

Also, any other vim editor commands are welcome that would be useful in this situation : )

srccon

Posted 2012-11-19T00:57:11.053

Reputation: 29

Answers

2

It would probably be better to set up a skeleton file (:help skeleton), but you can do:

 vim -c 'call append(0, ["foo", "bar"])'

to insert the two lines "foo" and "bar" at the first two lines of the new buffer.

William Pursell

Posted 2012-11-19T00:57:11.053

Reputation: 1 387

1So, by inference, you could add two blank lines by removing the 'foo' and 'bar'? – Jonathan Leffler – 2012-11-19T06:31:15.887

1If merely adding blank lines, I would prefer romainl's suggestion: vim -c 'normal 2O' +3 – William Pursell – 2012-11-19T18:13:45.073

0

vim -c "set textwidth=72" -c "set wrap" -c "set nocp" -c "set spell" -c "normal 2O" +3

should work. That's a Capital O, not a zero, by the way.

romainl

Posted 2012-11-19T00:57:11.053

Reputation: 19 227