Questions tagged [wrapping]
Vim is able to wrap lines when they are longer than the width of the window or than a user-defined width. Questions about how to customize this behavior.
81
questions
43
votes
6answers
16k views
Can I justify text in Vim?
The only reason why I'd ever edit a text file in Pico or Nano, and not in Vim was its "Justify" command ^J. It would reformat a paragraph of text, creating line breaks at word breaks so that the text ...
35
votes
4answers
14k views
How can I easily create and maintain tables?
Here is (part of) a table I use in some documentation:
+---------------+------------------------+---------------------------------------+
| TASK NAME | WHEN | DESCRIPTION ...
16
votes
1answer
297 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 ...
15
votes
1answer
2k views
Show partially hidden wrapped lines
I have turned on line wrapping with set wrap linebreak nolist in my .vimrc. However, this has the annoying behavior that lines not completely visible on the screen are hidden outright and replaced ...
13
votes
1answer
772 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:
# ...
11
votes
2answers
2k views
Configure which column `gq` wraps at?
By default, using gq with a movement command hard-wraps the text described by the movement command to 79 columns. (I'm relatively new to vi/vim so I don't know the correct terminology.) How can I ...
10
votes
2answers
690 views
Is there a setting to force a hanging indent on bulleted/numbered lists WITHOUT hard wrapping?
Basically, I'd like to have long entries for bulleted / numbered lists that automatically indent like so:
1. Congress shall make no law respecting an establishment of
religion, or prohibiting the ...
9
votes
1answer
748 views
Auto-format: wrapping later in line when inserting text
After reading help textwith and help fo-table, I expected that when I set
set textwidth=20 " for demonstration
set formatoptions=tcq
then inserting text would always eventually cause a line to wrap,...
8
votes
1answer
122 views
change meaning of “paragraph” for TeX input?
I'm writing LaTeX code which has a lot of sections like this
\begin{definition}
blah blah blah ...
...
\end{definition}
In normal text, I'm very fond of gq] to rewrap everything nicely. Inside a ...
7
votes
2answers
919 views
soft linewrap width
When wrapping text in GVim, the wrap occurs at the right side of the GVim window. I would prefer to have it wrap at column 80 however. A solution I have found is to :set columns=80, but this shrinks ...
6
votes
3answers
1k views
Vim wrap only current line
I've enabled set nowrap since I find that line wrapping makes it harder for me to quickly scan a document. It's also annoying having to scroll right to see the entire line that I am working on.
I'm ...
6
votes
2answers
698 views
Relative Numbers sidepanel with wrapped lines
I love the relative numbers side-column in vim but when I have wrapped lines it becomes inaccurate (or less usable since I can't use that number directly in a j/k command). I have nnoremap j gj in my ...
6
votes
1answer
112 views
Autoformatting LaTeX: how to add characters in front of a wrapped line
When writing LaTeX, I like a newline between every sentence as it helps me jump around more easily. Additionally, I put two spaces at the start of lines where sentences don't start. For example:
This ...
6
votes
0answers
998 views
What is the best practice in vim8 for wrapping with indentation aka breakindent
To have proper paragraph wrapping with indentation in vim (after vim7.4) we could use this:
" Wrap the text with identation isntead of the old way
set breakindent
set showbreak=\ \\_
Since vim8 ...
6
votes
0answers
39 views
Expand strings into multiline strings on line wrap [duplicate]
This is a feature in Eclipse that I would love to find a solution for in Vim.
I have Vim set up with tw=80 so that the lines wrap at 80 columns. When I'm in the middle of a string, and the line ...
5
votes
4answers
484 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" - ...
5
votes
3answers
7k views
How to stop gVim wrapping text at column 80
I have a README.txt file as follows:
This document is a list of
a) Known issues in the services or test environment, i.e. things expected to fail
b) Things to be improved in the test suite
c) ...
5
votes
2answers
559 views
How do I make Vim respect Markdown headers when formating text?
I want to use the combination gggqG to go to the top of the file and format the whole file from there, so that it fits into my 80 col textwidth border.
But when I do, vim ignores my markdown headers. ...
5
votes
1answer
2k views
How to automatically set wrapping for quickfix window?
I'm using Dispatch.vim, and often when there's a test error, some lines in the quickfix list are really long. I don't use soft wrapping for my code, so quickfix also isn't wrapped. Is it possible to ...
4
votes
1answer
284 views
How do I wrap the location-list by default (without turning on wrap for files)?
I think this should be a quick answer, but I can't figure it out from :help location-list and my Google searches seem to highlight that I may not know the correct terms to look for.
For the sake of ...
4
votes
2answers
1k views
How can I make vim's flowing aware of email replies?
Problem summary
I use vim to edit emails that I send with mutt. I also use format=flowed, which "reflows" text. That is, lines are limited to a fixed number of characters, and a "soft wrap" is ...
4
votes
1answer
627 views
How to go to the end of the line even in on a wrapped line?
I would like to map <End> and <Home> to go to the end or beginning of the current line (not the screen), even if the cursor is on a wrapped line:
|1 First line. |
|2 This is some ...
4
votes
2answers
87 views
Permission dependent behavior
I would like to set some options for all things I will read but not modify.
That is special settings for read-only files (and files in vim view mode).
Particularly I'm interested in setlocal wrap ...
4
votes
2answers
166 views
Apply formating with a script, or have ftplugin format particular text based on syntax
When I am writting a Latex document I generally like to keep an 80 column
line width to keep things easy to read. However I don't like to use text
wrapping because it can get in the way of typing ...
4
votes
1answer
227 views
Using `gq` to correctly wrap function arguments
Consider editing the code
foo = long_function_name(var_one, var_two, var_three, var_four)
where the textwidth 'column' occurs just after var_two.
I would like to be able to press gqq on the line ...
4
votes
1answer
84 views
Go to the last wrapped line with G
In Vim pressing G takes you to the last physical line. But, if the last line is wrapped around G puts the cursor on the first wrapped line in that last line, not the last wrapped line.
So, is there ...
4
votes
1answer
116 views
Hard wrapping a range to textwidth with an ex command
Also asking how to apply an ex range to a normal command.
In a file of some 125k lines with a preamble followed by 8 columns of 10 character wide text, the contents of the column are 8 characters of ...
4
votes
1answer
198 views
prevent line wrap in terminal buffer
I can easily see the output of a command in a split using vim's terminal
For example, I use :vertical terminal make re a lot.
This example is also stated in the help (h :terminal):
Or to run build ...
4
votes
0answers
199 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
0answers
246 views
Why does the vim-jedi popup have weird line wrapping?
When I'm nearing the right-hand side of my vim window, the vim-jedi's pop has some weird line-wrapping behavior:
Is this normal behavior? How can I get the popup window to be shifted leftwards and ...
3
votes
1answer
576 views
How can I force a page break in MacVim's printed output?
I've discovered the :hardcopy command, which is the equivalent of the Command-P command in MacVim.
I've also found that it accepts ranges. For instance, in my markdown file, I can split the sections ...
3
votes
1answer
60 views
How do I show a special symbol at the beginning of show lines (which are in the middle of logical lines) when wrap is on?
The screenshot of vim-gitgutter clearly shows its author uses some kind of continuation line character when wrap is on. How do I get that? I thought I could find it listed in :help 'listchars', but it'...
3
votes
1answer
49 views
Only wrap line when it becomes greater than 80 characters after previously being below 80
set tw=80 wraps lines after they reach 80 characters. Sometimes when I'm coding, writing notes, etc, I want some--but not all---lines to be longer than 80, so after it wraps, I join the line back with ...
3
votes
1answer
557 views
Show / hide horizontal scrollbar depending on “wrap” option
I'm trying to show / hide horizontal scrollbar conditionally, depending on wrap option:
with wrap - show horizontal scrollbar
with nowrap - hide
Here is what I tried, but for some reason it doesn't ...
3
votes
1answer
171 views
Break line even if it fits the screen
I think everyone knows that vim can't display multiline messages in quickfix (yes, I know that it can parse them and show them as one big line).
I thought about ways to workaround this and thought ...
3
votes
1answer
63 views
exclude a line from wrap
I often use the sequence gqap to hard wrap the current paragraph.
However I'd like some line to be excluded from the process.
Example
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ...
3
votes
0answers
61 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 ...
3
votes
0answers
63 views
Syntax-aware line wrapping
Is there a way to make the automatic line wrapping of vim aware of the syntax of the file instead of just wrapping at the closest whitespace?
I am specifically interested in Python but I guess it ...
3
votes
0answers
133 views
Prevent Vim from breaking up inline code blocks in (r)markdown
I edit R-markdown files a lot, and this entails writing inline code blocks, such as
`r sum(mylongvectorname)`
I usually have my text hard-wrapped at 80 chars, and this causes problems for the ...
2
votes
1answer
336 views
How to navigate long lines like separate lines?
When I have a very long line in vim it will be shown on the screen as multiple lines, like this:
line no. | content |
100 | this is a very ...
2
votes
2answers
364 views
Force (visual-only) wrap at specific column regardless window size in gVim
This is more gVim (Linux) related since Vim doesn't have a "window" of its own.
I'm trying to wrap a text at (say) 80th character, visual wrap only, no changes in file, hence no textwidth or ...
2
votes
1answer
49 views
How can I wrap text from the indentation level rather than the beginning of the line
This is better shown than explained. The first image shows how line wrapping works in VScode, and the second in vim.
In VScode the wrapped line continues at the indentation level of the line, rather ...
2
votes
1answer
56 views
gw text wrapping for LaTeX
Is there an easy way to wrap LaTeX source? Using gwip is great for individual paragraphs,
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore ...
2
votes
1answer
2k views
What is the standard way of creating new Vim Commands?
I was recently going through a tutorial on configuring the Vimrc file to make it behave more like traditional text editors. In that tutorial, I came across the following line: command! -nargs=* Wrap ...
2
votes
1answer
154 views
Delete wrapped lines?
How to delete wrapped lines?
I imagined something like gdd and gD but they did not work as expected, in a similar fashion to gj and gk to move through wrapped lines.
It would be really useful to ...
2
votes
1answer
107 views
automatic text wrapping messed up with parenthesis
I like to wrap my text to 80 characters all the time, even when I am editing Markdown.
I have a problem when I open parentheses: it doesn't wrap right anymore. Since it is hard for me to explain it, ...
2
votes
1answer
216 views
How to disable extends/precedes charaters in nowrap
I want to view a big blob of text (ascii-graphics), but when I use :set nowrap some < and > symbols appears at the left and right borders of the buffer window.
They are kinda annoying and I ...
2
votes
1answer
76 views
Is there any way to prevent a line from wrapping around while in visual mode?
If I am using visual block mode to append to a block of text and number of characters exceeds 80, then the line snaps and text is not appended to rest of the block. I want to find a way such that line ...
2
votes
1answer
42 views
How to soft wrap at column number greater than window width?
Imagine a 30-character line shown in a 20-character wide window. How can I soft wrap it at the 25th column?
With :set nowrap
|01234567890123456789|0123456789
| window |
After scrolling ...
2
votes
1answer
115 views
Keeping indent (like breakindent) when using hard wrap with textwidth
I know the breakindent option works with linebreak to preserve indent on wrapped lines. However, when I want to hard wrap lines (using the textwidth option so <EOL> is inserted when a line ...