Questions tagged [join]
The join tag has no usage guidance.
19
questions
1
vote
1
answer
26
views
Inconsistent string handling [duplicate]
I've been assembling strings in vimscript using a . as the join command.
But when I try and use the same command to join a string when setting an option, such as:
:setlocal foldtext=v:folddashes . &...
0
votes
1
answer
131
views
How to join multiple lines which doesn't include space at the end
I'm working on a subtitle document (.srt) which has thousand of lines. But this issue is not about the subtitle documents, I going to export as plain text to read after. To see the dialogs line by ...
-1
votes
4
answers
107
views
Remove blank lines appearing between non-blank lines without a regex?
What is the quickest way to un-doublespace in Vim, without using a regex?
I.e., convert
line one
<emptyline>
line two
<emptyline>
line three
to
line one
line two
line three
There's gotta ...
0
votes
0
answers
39
views
combining multiple lines [duplicate]
I have a text file of X ips and X files that looks like:
ip1
ip2
ip3
some_dir/file1
some_dir/file2
some_dir/file3
I'd like to combine the lines into a csv format, like:
ip1,some_dir/file1
ip2,...
1
vote
1
answer
40
views
How to only join lines that start with multiple spaces
what is the global command that will join lines that start with more than one space?
I have tried this but it does not work as expected:
:g/ \{2,}//J
Example:
I want to turn this:
01:001:001 In the ...
0
votes
1
answer
37
views
Join contiguous lines of natural text and leave adjacent, non-connected lines
I would like to join all lines in a file which are continuous parts of some natural language but not back-to-back lines which are two separate entities. For example:
Join:
There was once a man
called ...
0
votes
0
answers
26
views
Joining lines on Vim removes random characters [duplicate]
I have just noticed on my version of Vim (vim-tiny package on FreeBSD)
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jul 5 2021 16:53:06)
Included patches: 1-3081
Compiled by root@130amd64-quarterly-...
5
votes
1
answer
794
views
Join multiple lines based on pattern
I have text bounded by quotes as follows
"This is
an example
of some text"
I want to join these into one line. e.g.
"This is an example of some text"
I have tried commands like ...
3
votes
3
answers
730
views
Paste a block-copy into a single line
I need to restructure a markdown table, and for that, I wish there was a quick way to "join" lines from a multi-line cell.
So with Vim, I would have to yank the block (Ctrl-v), and then ...
1
vote
1
answer
43
views
Is it possible to ignore J if only one line is selected?
Today I made a macro that involved selecting a few lines to join. The problem was that sometimes I only selected parts of one line and in this case two lines was still joined with J. Is it possible to ...
4
votes
3
answers
295
views
How to join lines within a block with `J`?
I want to join all the lines within a {} block.
{
'a': 1,
'b': 2,
'c': 3,
}
⬇︎
{ 'a': 1, 'b': 2, 'c': 3, }
Since J doesn't take a range, like d or c, the best command I found to do this is ...
1
vote
1
answer
202
views
use J to join comments
Imagine I have comments
// line one
// line two
and I am on line one and want to join it with line two I will press J but that results in this:
// line one // line two
Instead of what I want
// ...
0
votes
2
answers
395
views
Vim: Foldtext contain all content, instead of only the first line
Would like to have all content of the folded block, instead of only the first line.
My current foldsettings are:
set foldmethod=marker
set foldmarker={,}
Example how my data is structured:
{
...
0
votes
2
answers
97
views
Prepend line underneath current line (or "join" to front of line)
I'd like to prepend the line below the current line to the current line. In other words, I want to "join" (like with J in normal mode) but instead of putting the line below the current line at the end ...
1
vote
1
answer
438
views
Preventing the join() command from adding extra space
I am trying to use the join command to join multiple strings. The join command seems to add one character of space in between each of the strings. But I don't want any space added.
As an example, I'm ...
1
vote
0
answers
87
views
Why are my bulleted lines automatically joining?
I use the a formatoption to make my text hard wrap, and the n formatoption to recognize numbered lists. The help says that the n option should use the formatlistpat regex to determine which lines not ...
2
votes
1
answer
1k
views
How do I remove newlines inside arbitrary xml tags matching a pattern?
I'm working with large xml files that have tags, and some are spread across multiple lines, and some are on a single line. I'd like them to all be on a single line. There are other tags in the files ...
4
votes
1
answer
1k
views
Join the line above the current line
I often use J to join the current line with the one below:
J Join [count] lines, with a minimum of two lines.
Remove the indent and insert up to two ...
1
vote
0
answers
39
views
substitute a join for a character that ends a line
when pasting from a pdf document, words in the original document are being split up, and replaced by a - and a line break. For example:
alternative specifications. In con-
clusion, these findings
...