Questions tagged [join]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer

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 . &...
markling's user avatar
  • 319
0 votes
1 answer

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 ...
Pascowl's user avatar
-1 votes
4 answers

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 ...
Geremia's user avatar
  • 956
0 votes
0 answers

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,...
wiggitywacker's user avatar
1 vote
1 answer

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 ...
Jan P's user avatar
  • 31
0 votes
1 answer

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 ...
Julius H.'s user avatar
  • 239
0 votes
0 answers

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-...
Karsten Pedersen's user avatar
5 votes
1 answer

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 ...
daviewales's user avatar
3 votes
3 answers

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 ...
PlasmaBinturong's user avatar
1 vote
1 answer

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 ...
Moberg's user avatar
  • 113
4 votes
3 answers

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 ...
Martín Fixman's user avatar
1 vote
1 answer

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 // ...
theonlygusti's user avatar
  • 2,229
0 votes
2 answers

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: { ...
Mia's user avatar
  • 1
0 votes
2 answers

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 ...
chb's user avatar
  • 136
1 vote
1 answer

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 ...
Trevor's user avatar
  • 477
1 vote
0 answers

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 ...
Christopher Shroba's user avatar
2 votes
1 answer

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 ...
JHiant's user avatar
  • 123
4 votes
1 answer

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 ...
Adam Matan's user avatar
1 vote
0 answers

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 ...
Leo Simon's user avatar
  • 715