How do I remove a newline from text in vi on Cygwin

3

1

I'm trying to ammend a commit comment on a git commit, so I git commit --amend then vi opens with text from the last commit's comment. Then I delete all of the text on the first line, but I cannot remove the newline character, how can I do that?

erikvold

Posted 2010-06-06T19:16:24.403

Reputation: 3 077

Answers

8

J - Join two lines

Douglas Leeder

Posted 2010-06-06T19:16:24.403

Reputation: 1 375

@Erik: If it has worked, please click on the tick left to the answer. – whitequark – 2010-06-06T19:30:46.057

I had to wait 2mins ={ – erikvold – 2010-06-06T19:37:11.213

J doesn't seem to work here, my cursor just jumps to the next line – nmz787 – 2017-11-03T21:32:22.097

seems the correct usage is SHIFT+J – nmz787 – 2017-11-03T21:33:33.433

4

You can use dd to delete the whole current line, whether it is empty or not.

Chris Johnsen

Posted 2010-06-06T19:16:24.403

Reputation: 31 786