:join
(or J
in normal mode) with selectable delimiters.
You can use the feature of this plugin via commands or key mappings.
If you use the default settings, there is NO need to call the setup function. Just install and use. Below is an example of redefining the default settings.
require("join").setup({
sep = " ",
sep_list = {
" ",
", ",
},
count = 1,
})
:[range]Join[!] [{sep} [{count}]]
- Join the selected lines with
{sep}
. - If you want to use spaces in a delimiter, please escape them with
\
. - The
{count}
is the offset of the last row. Negative numbers mean upward. - For example, if
:Join , -2
, then the current row and the top two rows, a total of three rows, are joined by,
. - With
[!]
, this command does not insert or delete any spaces (Same as:join!
). - If
{sep}
and/or{count}
are omitted, the ones defined in setup will be used (Defaults are,
and0
).
- Join the selected lines with
<Plug>(join-input)
- Defined in
n
andx
mode. - Use
vim.ui.input()
to set{sep}
and{count}
. - In visual mode (xmap), the input of
{count}
is omitted.
- Defined in
<Plug>(join-noinput)
- Defined in
n
andx
mode. - Don't input, use default
{sep}
and{count}
.
- Defined in
<Plug>(join-select)
- Defined in
n
andx
mode. - Use
vim.ui.select()
to set{sep}
from a collection{sep_list}
. - Use, however,
vim.ui.input()
to set{count}
. - In visual mode (xmap), the input of
{count}
is omitted.
- Defined in