Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [line-breaks]

Breaking of lines on the display or in the file.

2
votes
0answers
19 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 ...
0
votes
0answers
45 views

E20: mark not set error occurs sometimes

I am editing latex1 prose in vim. For paragraph reformatting, I am using the par text formatter. I have set up the following autocommand for latex-files, to map A-q for reformatting the whole ...
1
vote
2answers
56 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 (...
0
votes
1answer
42 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 ...
0
votes
0answers
60 views

Poor performance of vim with line >6000 characters long - how to fix?

I'm working with a very long string of encoded data and every time vim needs to operate around that line I get very long lags. The line is >6000 characters. I'd rather not split the line, since it's ...
0
votes
1answer
38 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 ...
2
votes
0answers
154 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&...
1
vote
1answer
317 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
1
vote
1answer
160 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 ...
0
votes
1answer
78 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 ...
4
votes
1answer
68 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 ), ...
2
votes
1answer
56 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 ...
0
votes
1answer
179 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 ...
3
votes
1answer
1k 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 ...
6
votes
1answer
123 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 ...
3
votes
1answer
179 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 ...
1
vote
1answer
66 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 "...
8
votes
1answer
255 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 &...
0
votes
1answer
295 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, ...
3
votes
5answers
1k views

Join multiple lines

I have a file similar to this: aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccccccccc dddddddddddddddddddd aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccccccccc dddddddddddddddddddd ...
12
votes
1answer
696 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 ...
1
vote
1answer
422 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 ...
4
votes
0answers
119 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' '*...
4
votes
1answer
56 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] » ...
8
votes
1answer
311 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 ...
1
vote
3answers
402 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 ...
3
votes
2answers
225 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 ...
11
votes
6answers
5k 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 ...
1
vote
1answer
87 views

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<string> forEachEventAction) If I ...
1
vote
1answer
141 views

How to substitute line break on register?

Suppose the content in register b is: a^Jbcdefg, ^Jhijkl^J^J, I want to format it by substituting ^J with a space to make it looks like this: a bcdefg, hijkl. I've consulted many documentations but ...
13
votes
3answers
6k views

How to make vim automatically add a newline to the end of a file?

Vim normally writes <EOL> for the last line only when there was one in the original file. How to make vim to write a new line at the end of a file all the time (when the file is not binary and ...
16
votes
4answers
1k views

How to set up Vim to work with one sentence per line?

I'm currently writing a lot of plain text (and LaTeX with minimal formatting in paragraphs), and it would be nice if I could set up vim to keep each sentence (for simplicity, text terminated by a '. ',...
5
votes
1answer
395 views

How to substitute text across line breaks?

I would like to reformat code in an entire file from this brace style: if (condition) { body; } … into this brace style1: if (condition) { body; } The bulk of the task should be ...
13
votes
1answer
545 views

Can I add an end-of-line string when Vim wraps a line due to textwidth? [duplicate]

When I have automatic wrapping enabled, I can write some text like This line is starting to get fairly long so it has been wrapped If I start writing a comment, I get fairly sensible behaviour: # ...
21
votes
1answer
160 views

How does :g/^$/,/./-j (reduce multiple blank lines to a single blank) work in vim?

In the article, Vim Regular Expressions, Oleg Raisky gives the following command to reduce multiple blank lines to a single blank: :g/^$/,/./-j Can someone please describe how this works? I know :...
3
votes
1answer
866 views

How can I get syntax highlighting to support multiline JavaScript strings?

Currently I have JavaScript (.js) files that contain multiline strings. Vim's syntax highlighting does not seem to support these, as seen in the image below: Anything below the first line is not ...
22
votes
4answers
1k views

How can I reformat a multi-line string in vim when using the Python filetype?

Let's assume I am editing some Python code in vim that looks a bit like: myobj.myfunc("Some string parameter that goes on and on and on and on and sometimes doesn't" "split very" ...
7
votes
3answers
7k views

How to split a line into multiple lines efficiently?

I've been receiving logged data in a text file that is just one long line with each value separated by a space. Is there a command or set of commands that will split one line into multiple lines?
15
votes
3answers
5k views

Keeping lines to less than 80 characters [duplicate]

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 ...
16
votes
1answer
203 views

Prevent Vim from breaking up links mid-tag in markdown

Let's say I have this Markdown file: [Lorem ipsum dolor sit ](http://vi.stackexchange.com/many-links-are-often-very) Lookin' good. But the link isn't finished it, so I type -long, and now Vim breaks ...
116
votes
4answers
67k views

What's the simplest way to strip trailing whitespace from all lines in a file?

It's pretty common when programming or opening text files to encounter files with trailing whitespace at the end of a line. vim has a way to show this by setting the trail option in the listchars ...
61
votes
3answers
11k views

How to join lines without producing a space?

The standard J command for joining lines replaces the newline character(s) with a space. It's useful when editing 'literature' but can be troublesome if I, say, edit a hex dump by hand if I forget to ...