5

There are two problems with your approach. First is using -b which turns on the 'binary' setting and the binary setting will ignore fileformat. See this snippet of :help 'binary': Also, 'fileformat' and 'fileformats' options will not be used, the file is read and written like 'fileformat' was "unix" (a single <NL> separates lines). The second part ...


2

As stated in your comment you have cindent and cinoptions set like: set cindent set cinoptions=N-s,g0,:0,(0 The options cindent should only be set for the file types you want to use it. It is set automatically for the C or CPP file types (assuming you have filetype indent on in your vimrc [or better: filetype plugin indent on]). Remove the line set ...


1

Select the lines you'd like to merge, enter an Ex command by typing a colon : in normal mode. Then type this command: s/$\n\s*//gc The entire command should look likewise: :'<,'>s/$\n\s*//gc This is actually a tweaked version of the @insidepower's command that replaces space-indentations as well as newline characters. Explanation: '<,'> ...


1

To always join with a single space : nmap J gJi <ESC>ciW <ESC> To join with no space at all (removes trailing+leading space) : nmap <C-J> gJi <ESC>diW


Only top voted, non community-wiki answers of a minimum length are eligible