Stack Exchange Network

Stack Exchange network consists of 175 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 [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.

35
votes
6answers
11k 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 ...
26
votes
4answers
8k 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
216 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 ...
14
votes
1answer
1k 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
583 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: # ...
9
votes
1answer
469 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
90 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 ...
8
votes
0answers
437 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 ...
7
votes
2answers
597 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 ...
7
votes
2answers
724 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 ...
6
votes
3answers
684 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
1answer
82 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
36 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
2answers
424 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. ...
4
votes
1answer
1k 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
173 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
950 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
3answers
4k 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) ...
4
votes
2answers
74 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
128 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
2answers
396 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 ...
4
votes
1answer
81 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
83 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
0answers
634 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 ...
4
votes
0answers
138 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' '*...
3
votes
1answer
352 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
107 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 ...
3
votes
1answer
107 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
57 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
55 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
182 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 ...
2
votes
1answer
374 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 ...
2
votes
1answer
325 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
83 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
91 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
198 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
71 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
4answers
580 views

Is there a vimscript function to wrap text

Is there a vimscript function that wraps text in a similar manner like gqgq does? For example, if I have the following string variable: let txt = 'One foo, two bars and three bazes went up the hill' ...
2
votes
0answers
35 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 ...
2
votes
0answers
292 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&...
2
votes
0answers
94 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
0answers
126 views

Possible to exclude comments from textwidth?

I recently discovered the textwidth setting, which lets me configure vim to insert a "smart" whitespace-delimited carriage return as I'm typing when my line of text exceeds my specified limit. Is ...
2
votes
0answers
72 views

Dividing long paragraphs across pages

By default, vim will not split long paragraphs (or any paragraphs (= long lines)) across pages. Instead of showing the first part of a paragraph that does not fit into the page entirely, it leaves out ...
1
vote
2answers
131 views

Full width Vim help text

Is it possible to view the help in Vim at a text width greater than 77 characters? Can Vim reflow the help text?
1
vote
2answers
234 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 ...
1
vote
1answer
79 views

formatoptions for hybrid (short markup + long paragraphs) content

I am trying to write my PhD thesis in vim using LaTeX So the documents will have two distinct types of content - markups that are relatively short, and paragraph text that is rather long. \begin{...
1
vote
1answer
40 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 ...
1
vote
1answer
75 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 "...
1
vote
1answer
50 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 ...
1
vote
0answers
26 views

Do not wrap certain environments [duplicate]

I am using neovim. When editing a .tex file I don't want to wrap the lines within certain environments like equation or align and some others. \begin{equation} % very long line I don't want to ...