在 Vim 中删除换行符 [英] Delete newline in Vim
问题描述
有没有办法在 Vim 中删除行尾的换行符,以便将下一行附加到当前行?
Is there a way to delete the newline at the end of a line in Vim, so that the next line is appended to the current line?
例如:
Evaluator<T>():
_bestPos(){
}
我想将所有内容放在一行中,而不是复制行并将它们粘贴到前一行中.似乎我应该能够将光标放在每一行的末尾,按下一个键,然后让下一行跳到光标所在的同一行上.
I'd like to put this all on one line without copying lines and pasting them into the previous one. It seems like I should be able to put my cursor to the end of each line, press a key, and have the next line jump onto the same one the cursor is on.
最终结果:
Evaluator<T>(): _bestPos(){ }
这在 Vim 中可行吗?
Is this possible in Vim?
推荐答案
如果您在第一行,按(大写)J 会将该行和下一行连接在一起,删除新队.您也可以将其与计数组合,因此按 3J
会将所有 3 行组合在一起.
If you are on the first line, pressing (upper case) J will join that line and the next line together, removing the newline. You can also combine this with a count, so pressing 3J
will combine all 3 lines together.
这篇关于在 Vim 中删除换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!