How do I join lines without adding or removing any space characters?

By default, when you join lines using the “J” or “:join” command, Vim will replace the line break, leading white space and trailing white space with a single space character. If there are space characters at the end of a line or a line starts with the ‘)’ character, then Vim will not add a space character. To join lines without adding or removing any space characters, you can use the gJ or “:join!” commands.

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind