sponsor Vim development Vim logo Vim Book Ad

conjoin : Remove continuation characters when joining lines in vim

 script karma  Rating 4/1, Downloaded by 147  Comments, bugs, improvements  Vim wiki

created by
Trevor Stone
 
script type
utility
 
description
conjoin is a plugin that handles line joining in the presence of line continuation characters.  Vim's normal behavior for `J` and `:join` on the following shell script:
  cat file.txt \
    | sort \
    | uniq -c
leaves the backslash continuation characters in place:
  cat file.txt \ | sort \ | uniq -c
With conjoin, running join commands will produce
  cat file.txt | sort | uniq -c

String literals concatenated over several lines in languages like Python and Java are merged too.

By default, conjoin will create mappings for `J` and `gJ` as well as a `:Join` command.  If a mapping already exists, conjoin will call the prior mapping after removing continuation characters.  This lets it work well with splitjoin (vimscript #3613) as long as splitjoin appears before conjoin in runtimepath.

conjoin comes with support for continuation characters in many programming languages.  See `:help conjoin` or https://github.com/flwyd/vim-conjoin for details on defining your own.
 
install details
Unzip the script package and add the path to vim-conjoin to your runtimepath.  Alternatively, use a plugin manager:
" vim-plug:
Plug 'flwyd/vim-conjoin'
" Vundle:
Plugin 'flwyd/vim-conjoin'
" vim-addon-manager
VAMActivate github:flwyd/vim-conjoin
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-conjoin-1_0.zip 1.0 2021-01-24 7.0 Trevor Stone Initial upload
ip used for rating: 54.211.203.45

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github