Questions tagged [line-breaks]

Breaking of lines on the display or in the file.

Vim has a number of different ways to break or display long lines. This tag should be used for question that relate line-breaking questions on the display or changing the line breaks in the file.

64 questions
33
votes
7 answers

Can I join lines with a comma (or another character)?

I know I can join lines in Vim with J and several variants thereof (gJ, etc.); J will "Remove the indent and insert up to two spaces". But is there also a straightforward way to insert another character instead of the two spaces? For example a comma…
Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
25
votes
3 answers

Keeping lines to less than 80 characters

The code standard that I use indicates that lines should have less than 80 chars. I want to indicate this automatically while I write to avoid raising the error later. What is a good way of showing it?
Khelben
  • 3,187
  • 2
  • 14
  • 12
8
votes
1 answer

Automatically breaking lines in comments?

Vim has the excellent command set tw=79 which will automatically break your lines at 79 characters, however I like (just) my comments broken at 72 characters automatically. Is there any good way to do this in Vim?
user530873
  • 648
  • 4
  • 8
3
votes
5 answers

Join multiple lines

I have a file similar to…
Mehdi Nellen
  • 191
  • 3
  • 11
3
votes
1 answer

arbitrary line endings in vim?

Is there any way to tell vim to use the NUL character as the end-of-line marker instead of LF, CR/LF, or CR? More generally, is it possible to use any arbitrary character or sequence of characters as the EOL marker? NOTE: I do not want to convert…
cas
  • 133
  • 1
  • 5
2
votes
1 answer

Change line breaking behaviour based on syntax of text vs. code

I am using Vim to edit LaTeX documents. I know I can use :set linebreak to prevent Vim from breaking lines in the middle of a word, but this works globally. Is there a way to have line breaking respect word boundaries on text, but not break wherever…
aky-her
  • 143
  • 5
1
vote
1 answer

Why are new lines being added automatically when I insert backticks?

I'm running gVim 7.4 on Windows 7. I'm editing a text file and I insert text like the following: 1 - public SomeResult GenerateResult(IInput input, Action forEachEventAction) If I add a ` before public and after the closing parenthesis…
Kenny Evitt
  • 243
  • 1
  • 9
1
vote
1 answer

Line breaks while typing but can be fixed after with cap-J

My lines break when I am typing beyond a certain length in vim, but afterwards, if I move up one line and type J, the line will reconnect. So it is apparently not a matter of fixed length. I would like the line not to break while typing. Is there a…
barnhillec
  • 121
  • 4
1
vote
1 answer

how to break a long line into 80 characters per line

my .vimrc setting for wrapping line: set nowrap " Don't auto wrap on load set fo-=t " Don't wrap text when type "set colorcolumn= 80
janicebaratheon
  • 111
  • 1
  • 2
1
vote
2 answers

how to avoid vim breaking line beyond 80 characters in fortran files

I have added the following two lines into my .vimrc file " stop fortran 90 from automatically insert line break beyond 80 set textwidth=0 wrapmargin=0 " stop vim wrapping beyond 80, avoid visual breaking in vim set nowrap but still no success. vim…
bsmile
  • 23
  • 3
0
votes
2 answers

how to delete every char except newline?

Is there a simple way to delete all text except newlines ? I found one that removes all empty lines :g/^$/d. but I am looking at the opposite functionality, some command that deletes everything except newlines ? If you are wondering why, it's mainly…
sourcevault
  • 101
  • 2