Questions tagged [line-breaks]

Breaking of lines on the display or in the file.

Filter by
Sorted by
Tagged with
2 votes
1 answer
61 views

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 ...
aky-her's user avatar
  • 143
1 vote
1 answer
81 views

What is the meaning of lbr in Vim?

I write set lbr in my vimrc file but I don't know the meaning of that. What does this option do? I know it's about line-breaking but I need more explanation. This is from the Vim document and I can ...
mohamadi_arch's user avatar
0 votes
2 answers
40 views

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 ...
sourcevault's user avatar
0 votes
1 answer
119 views

Any .vimrc hacks to make vim automatically start a new line when you exceed line length?

Normally, when you type text (this is just annoyance when you are taking notes) in vim, and you exceed the line length of the program, it keeps the line going but the line number isn't present: 100 ...
user avatar
6 votes
1 answer
556 views

What does breakat&vim mean?

I'm trying to understand this SO answer. The snippet reads: :set nolist wrap linebreak breakat&vim
John Schmitt's user avatar
0 votes
1 answer
43 views

How to prevent an extra newline from being appended to macros ending with a newline? [duplicate]

If I save a macro by typing: :let @s='/{<C-v><C-m>'<Enter> which looks like: :let @s='/{^M' the macro that is actually saved is /{^M^M, with an extra linebreak (that I did not type)...
ban_javascript's user avatar
2 votes
2 answers
50 views

Function for recursive linebreak

I am writing my .tex files in vim and have automatic linebreaks at 80 characters. I would like the linebreak to automatically perform a concatenation J if there is text below it, so that I don't get ...
Andrew Draganov's user avatar
1 vote
0 answers
348 views

neovim: breakindent results in slow insert mode

I had the feeling that neovim was being sluggish in insert mode so I started bisecting my init.vim. Contrary to my expectations it looks like dozens autotrigger snippets were not the culprit but rater ...
0x539's user avatar
  • 197
0 votes
1 answer
36 views

Is there a soft/visual textwrap equivalent option? [duplicate]

I like textwidth, except that it inserts EOL characters, and that breaks what I consider to be a sentence. I'd like to go back to having a long sentence be a long sentence, but I want it visually ...
Harv's user avatar
  • 219
0 votes
1 answer
806 views

How to show signs at the end of each line

is there any plugin that add the signs at the end of the line as shown in the image?
Irvin Hernández's user avatar
4 votes
1 answer
454 views

Showing showbreak character at the end of the line that is wrapping

Is there a way to show showbreak character at the end of the line that is wrapping, not at the beginning of the next one? 1. Lorem ipsum dolor sit amet, consectetur \ adipiscing elit, sed do ...
J. Doe's user avatar
  • 41
0 votes
1 answer
69 views

Vim doesn't respect the initial tab distance of a paragraph

I have lines of text like these (each of one are single lines): https://i.stack.imgur.com/uh7Uc.png Since those text lines have a lot of words vim distribute the whole single line in several sublines(...
GhostOrder's user avatar
0 votes
2 answers
472 views

How to insert a blank line above another line

I have these lines; Question1. Is this true? a. Yes b. No Question2. How is the weather a. Good b. Bad Question3. The sky is a. Dark b. Blue I wanted to change it to; Question1. Is this true? a. Yes ...
atheros's user avatar
  • 125
1 vote
1 answer
29 views

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

Join all non-blank lines

When editing markdown and other text files, I like to use textwidth/wrapmargin to insert line breaks at fixed intervals. (The advantage of this is that each visual line is a Vim "line" - ...
Josh Friedlander's user avatar
1 vote
0 answers
40 views

why is the terminal output resized, after the command is executed, when moving it from a function

The problem I'm trying to write a function that outputs a shell command in a terminal vertical split. Vim's terminal, as any terminal, will break lines that are wider than the terminal window. As ...
Biggybi's user avatar
  • 2,730
4 votes
1 answer
339 views

'endofline' option stays false after write operation

When one opens a file with an incomplete last line (File does not end with 0x0A / a new line character), the endofline option is set to false (:echo &endofline will print 0) and the [NOEOL] ...
dirdi's user avatar
  • 141
2 votes
1 answer
1k views

Why does not Vim feed the correct set of newline characters?

I'm trying to wrap my head around how Vim deals with line endings in different file formats. Say you have a file with DOS line endings, file.txt: echo -en 'line1\nline2' > file.txt unix2dos file....
ollehu's user avatar
  • 23
3 votes
0 answers
339 views

Treating lines wrapped with `linebreak` as separate lines

I know the linebreak option can be used to soft-wrap lines within vim (without inserting any newlines into the file being edited). However, I often need to navigate over long lines that have been ...
myc3lium's user avatar
1 vote
1 answer
403 views

Why is the commit message inside parentheses wrapped so strangely?

I sometimes need to do some remarks in parentheses in my commit message's detailed part. But when the parenthesized text comes to the rightmost column and is line-broken, the next line for some reason ...
Ruslan's user avatar
  • 475
1 vote
0 answers
256 views

Break visual line without hard breaking line

Is it possible to break visual line without breaking line? For example: Some text blah blah "insert visual break" "cursor now here" keep writing. But both these sentences is one wrapped line. ...
Yasha's user avatar
  • 111
4 votes
2 answers
10k views

Automatic wrapping to new line?

Instead of wrapping lines visually, I want vim to wrap with a linebreak regardless of my the window dimensions. How can I set this automatically
Hussar's user avatar
  • 75
1 vote
1 answer
312 views

xml ftplugin overrides textwidth

I would like to hard wrap XML files during editing. In every other filetype my set textwidth=80 works fine. But in XML something overrides the insertion of line breaks. I tried adding t to ...
musarithmia's user avatar
1 vote
1 answer
546 views

Insert Page break ^L automatically after specific number of lines/characters?

How could VIM (script?) insert ^L (page break) and /r on an empty line, automatically after every 30 Lines OR 1800 characters while writing? Any ideas?
Thomas D's user avatar
2 votes
0 answers
77 views

Extending the true line width to enable screen readers to see what blind users cannot

Vim is outstanding. It holds a lot of potential for blind users. I still have one out-of-the-box problem when using vim with screen readers (tested with both NVDA and System Access). But that surely ...
guestuser001's user avatar
1 vote
2 answers
375 views

separating folds with constant amount of newlines

Is there a succinct way to separate folds, open or closed, by the same number of newlines throughout the buffer? I'm using fold by indent. The goal is two visible blank lines between each fold (...
kevinlawler's user avatar
1 vote
1 answer
245 views

Convert newline to something else in variable using substitute

Inside of a variable, a newline is encoded as ^@ which represents a null byte. In the vim Ex command line it is possible to issue something like substitute(var, '^@', '\\n', 'g'), this produces \n ...
Steven Lu's user avatar
  • 2,251
0 votes
1 answer
1k views

How can I soft-wrap a word to a new line?

Using textwidth (tw=74) a word will be moved to the next line (with an indent usually) with a newline character at the end of the line avoiding over-length. This is a hard wrap, and resizing the ...
user3.1415927's user avatar
2 votes
2 answers
1k views

The indent of wrapped lines

My vimrc about wrap is set like this: set wrap "Wrap lines set breakindent " indent after line wrapped But the wrapped lines are not equal in length, such as: line 1: some contents ..... <end&...
CoinCheung's user avatar
1 vote
1 answer
4k views

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's user avatar
1 vote
2 answers
1k views

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 ...
bsmile's user avatar
  • 23
4 votes
1 answer
672 views

How to make linebreak play along with conceal

I am using vimwiki with and conceal the long URLs as links like this: [[http://a-really-long-long-url|Link]] rest of text Under my configuration (conceallevel=2 concealcursor=nc linebreak) it should ...
Beka's user avatar
  • 295
3 votes
1 answer
333 views

How to jump to a next or previous specific character ignoring linebreaks and not destroying highlight or overwriting my registry?

I have not found much use for ()[]{}, and so I want to map them so it does a find command, jumping to the previous instance of that particular character. Thus, ) will jump forward to the next ), ...
Anon's user avatar
  • 885
3 votes
1 answer
128 views

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 ...
cas's user avatar
  • 133
0 votes
1 answer
915 views

Insert carriage return in a vimscript variable

A vimscript variable longstring (for instance obtained by let longstring = getline('.')) contains a long sequence of characters (numbers, letters, commas, spaces, ...). I want to replace a specific ...
Enlico's user avatar
  • 2,194
5 votes
1 answer
6k views

What is the significance of "Incomplete last line" when opening a file?

I occasionally open a file with vim and see something like this: "<file name>" [Incomplete last line][dos format] 71 lines, 2912 characters I understand all of that information except ...
pattivacek's user avatar
5 votes
1 answer
649 views

How to make a syntax region stop on empty lines?

I would like to adapt this syntax file so that the formatting in VIM matches more closely what this online Markdown editor (GitLab-flavor) displays (the output on the right is relevant, this is how I ...
StaticNoiseLog's user avatar
7 votes
1 answer
2k views

Line formatting (gq) does not correctly indent long list items

I want to wrap my text to 79 characters, I do that using the gq command. For most filetypes this works just fine and indents following lines. With Markdown, however, it does the following: The ...
Martin Ueding's user avatar
1 vote
1 answer
176 views

wrap breaks when using delete or change word type commands

Using these options set wrap linebreak nolist set showbreak=~ "adds specified character after wrap set breakindent "forces word wrap to start at last lines indentation level set display=lastline "...
Wumbo's user avatar
  • 157
8 votes
1 answer
364 views

How do I configure vim to show a character when a line is too long to be displayed?

I want to be notified when a line is too long to fit in the window. Right now I have this in ~/.vimrc: set wrap let &showbreak = ' +++ ' I'd like to change that to: set nowrap let &...
tex's user avatar
  • 85
0 votes
1 answer
1k views

Getting Error while opening files through vim

I am trying to use unicode characters in vim. Since msdos prompt didnt support unicode, I downloaded cygwin. I added some commands in .vimrc through cygwin. Basic commands like setting encoding, ...
SibiCoder's user avatar
  • 3,352
3 votes
5 answers
4k views

Join multiple lines

I have a file similar to this: aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccccccccc dddddddddddddddddddd aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccccccccc dddddddddddddddddddd ...
Mehdi Nellen's user avatar
14 votes
1 answer
2k views

Why is a Line Feed converted into a Null character inside the search register and into a Carriage Return on the command line?

If I have the following text: foo bar I visually select it and copy it. The text is now stored in the unnamed register " and here is its contents (output of :reg "): "" foo^Jbar^J According to ...
saginaw's user avatar
  • 6,756
5 votes
1 answer
2k views

Still force new line at end, but show it too?

Some people prefer not to end a file with a new line. I'm not one of them. In fact, I want to see that it's there! How can I keep this 'force new line at end' behaviour, but show it in the editor? I ...
OJFord's user avatar
  • 425
5 votes
0 answers
242 views

Set line breaks, word wraps and word searching for Thai and other non-latin languages

I can set the text width and can manually line break imported paragraphs with the following as an example. set textwidth=72 gqq I can also navigate English text files with the standard 'w' 'b' 'e' '*...
BrianWilson's user avatar
6 votes
1 answer
134 views

Adding new characters cause splitting line into many lines

I'm analyzing a lot of logs using VIM version 7.3 (2010 Aug 15, compiled Sep 24 2013 13:45:11). Recently I obtained logs that look like this: 3521:2015-09-28T09:18:36.922557+00:00 192 [info] » ...
lewiatan's user avatar
  • 421
8 votes
1 answer
849 views

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 ...
user530873's user avatar
1 vote
3 answers
873 views

How to append a random number between a range [1,10] at the end of each line in Vim?

I have a graph data in a file with each line containing the source and destination node of an edge. I want to assign a random weight between [1, 10] for each edge to test my graph algorithm. How can I ...
Shashidhar G's user avatar
4 votes
2 answers
969 views

Breaks line without leaving insert mode

With the textwidth option set the text written can be wrapped when we leave insert mode. If I type a line longer than my textwidth value then it will go on a new line. e.g. with set textwidth=5 and ...
nobe4's user avatar
  • 16k
33 votes
7 answers
17k views

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 ...
Martin Tournoij's user avatar