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.

Filter by
Sorted by
Tagged with
8 votes
1 answer
486 views

When using nowrap, how can I delete a line and stay in the same screen?

I sometimes work with files that have longish (200+ characters) lines, and I've recently discovered the joy of :nowrap mode. It's quite convenient. However, when I'm scrolled over to the right by a ...
0 votes
0 answers
71 views

Vim for writing prose: cursor in insert mode with soft wrap

I'm new to this forum and use Vim to write prose. I'm trying to configure a desired behavior when soft-wraping text. I only have three lines in my .vimrc set nocompatible set wrap set linebreak This ...
0 votes
0 answers
25 views

Having hardwrap based on window size

Is there a way to set automatically textwidth to the size of the the vim/neovim window ? The purpose is to have a hardwrap behaviour based on the size of the screen. My use case : I am currently using ...
  • 315
0 votes
1 answer
36 views

How do I determine the indentlevel to customize showbreak?

I want wrapped lines to look like this: some really long line that | ... reached the end of the | ... window. | const indented = () => { | // a really, really, | ... really ...
4 votes
1 answer
71 views

How can I show the syntax-colored current line wrapped on top of current line in nowrap buffer?

I know this can look a lot like a duplicate of Vim wrap only current line, but none of the answers give a real solution to the original problem, as all of them state that per-line soft wrapping is not ...
  • 2,014
2 votes
1 answer
164 views

Why "c" option in formatoptions makes Vim hard-wrap my lists in "text" files?

Here is my test .vimrc: unlet! skip_defaults_vim source $VIMRUNTIME/defaults.vim set textwidth=78 let &colorcolumn = &textwidth + 1 set linebreak breakindent set number augroup ...
8 votes
1 answer
327 views

Avoid breaking words before or after asterisk ('*')

If you have set wrap, sometimes you can see something like this: 5. A soft-wrapped line with an * italic* word. I would prefer Vim to not soft-wrap before or after asterisks, and so the same ...
5 votes
1 answer
82 views

Is it possible to wrap and properly align inline comments?

set textwidth=60 let &colorcolumn=&textwidth set linebreak Is there a relatively simple way (that is, with using formatoptions only) to make Vim format inline comments (gq) from this: ...
2 votes
1 answer
131 views

The right way of mapping 0, j, k, ^, $ to g0, gj, gk, g^, g$ when wrap is set

First, I'm not sure just mapping j to gj always is a good idea, because, for instance, I don't want j to behave as gj when wrap is off and the line is longer than the screen. How can I make 0, j, k, ^,...
  • 2,014
5 votes
1 answer
45 views

line-wrapping without affecting math equations

Consider we have a long paragraph in a .tex file that includes displayed-math formula. For example This is a long paragraph that includes many sentences with a few math equations. For example, this ...
  • 151
0 votes
0 answers
30 views

vim-ternimal normal mode splits wrapped lines to 2 lines

Is there a way to make vim treat it as a single line? This blocks some functionality for example navigating to that line and hitting gf to open the file. Because it is read-only I can't even join the ...
1 vote
1 answer
39 views

Unexpected behavior in edited vimrc: dropped out of insert mode when hitting empty line

sorry for the bad title. I could not think of how to better summarise the problem. I should also state, that I am fairly new to vim, so please be a bit considerate :). I made the following changes in ...
  • 13
1 vote
1 answer
36 views

Why `textwidth` gives me the same effect as `linebreak`?

Could anybody explain, why textwidth works gives me the same effect as linebreak? Example 1. If I type aaaaaaaaaaaaaaaaaaa several times, the last aaa... is wrapped to the next line. linebreak is off, ...
3 votes
1 answer
152 views

Reformatting comments with gq, using spaces in 'comments'

I'm using Prettier to automatically reformat JavaScript (well, TypeScript, but same deal in this situation) source-code. It enforces a comment-style like this, with leading spaces replaced with ·: ···/...
0 votes
1 answer
34 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 ...
  • 209
3 votes
1 answer
134 views

LaTeX: turn off text wrap and auto indent in maths environments

I use vim with vim-latex for editing latex files. I always have hard wrapping enabled using set tw=80. I also have the default vim-latex auto indent settings enabled. I wonder if there is a way to ...
  • 131
2 votes
1 answer
229 views

In nowrap mode, is it possible to add a ">" sign to signal there's text rightward that hasn't been displayed?

So currently I'm disabling wrap in my vim, but I remember in vim when wrap is disabled and the line is too long to display, it would add a ">" at the end of the line so you know the line ...
0 votes
1 answer
48 views

Hard-wrap multiple lines without selecting them?

To hard-wrap a single line, we can use gqq, and to hard-wrap multiple lines, we can select them in visual mode and then use the same gqq command. However, I suppose that there is probably a smarter ...
0 votes
1 answer
213 views

nowrap option on a file opened in split window

I use set nowrap option in my config file, but when I open a file in a vertical split it has no effect. If I redo set nowrap after open the file (in the split windows) it takes effect Why? I try with ...
3 votes
1 answer
294 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 ...
  • 31
2 votes
1 answer
142 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 ...
  • 391
4 votes
1 answer
500 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'...
  • 2,014
1 vote
1 answer
127 views

Using cindent and/or `gq` to wrap long function arguments to one-per-line

When a line becomes too long, I would like to wrap the function call with a "one argument per line" syntax: For the example: :set textwidth=50. Given: long_function_name(argument_one, ...
  • 113
1 vote
1 answer
74 views

How to have l and h at the boundary of the window shift only one column, when wrap is off?

How can I have h and l move the viewport only by one column when they go beyond the left and right borders when nowrap is active?
  • 2,014
0 votes
1 answer
436 views

Vim keeps auto wrapping lines when in insert mode, how can we change this?

I'm not sure why this started to happen but recently vim seems to have begun autowrapping lines when in insert mode. It's pretty annoying. I use the following modules 'vim-ruby/vim-ruby' 'rodjek/vim-...
  • 109
1 vote
0 answers
52 views

How to make Vim not be a line editor

Vim is famously (or infamously) a child of line-based editing. For many cases this is acceptable. But I wish to use it primarily as an academic tool with large amounts of text. I want the experience ...
6 votes
4 answers
913 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" - ...
3 votes
1 answer
824 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 ...
0 votes
1 answer
89 views

have text longer than a vim windows displayed on several lines

I'm trying to have text longer than a vim windows displayed on several lines. For this, I tried to follow the advice of this blog by entering set wrap in the .vimrc file but nothing changes and the ...
  • 149
0 votes
0 answers
20 views

Wrap specific lines in buffer

is it possible to set nowrap to a line range in the active buffer and set wrap to everything else? I edit LaTeX files. I want to see everything after \begin{document}. but only see the general ...
7 votes
1 answer
902 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 ...
  • 2,649
0 votes
0 answers
22 views

display visual lastline instead of whole line with 'wrap' on [duplicate]

With set wrap, is there any way to not show the whole logical line when scrolling after the last line or before the first with gj and gk, but only the visual line? The goal is to prevent jerky ...
  • 2,649
1 vote
0 answers
25 views

Navigating wrapped paragraph as multiple lines [duplicate]

Vim wraps text around as most other text editors, but does not allow the same kind of navigation within wrapped lines. Take for instance a piece of text composed of several long paragraphs. If the ...
2 votes
1 answer
537 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
1 answer
88 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 ...
3 votes
0 answers
209 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 ...
2 votes
1 answer
412 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 ...
4 votes
1 answer
1k 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 ...
  • 43
1 vote
0 answers
34 views

Wrap matches shown by You Complete Me

Is it possible to wrap the matches shown by YCM ? My current workaround is to decrease font size till I am able to see it and then increase font size. This is tedious and painful. Is there any other ...
4 votes
1 answer
2k views

How to wrap lines on hotkey but not automatically?

A bit of context: I'm trying to use NeoVim after Spacemacs. In Spacemacs, there is gql key combination that hard wraps current long line of text into multiple short lines. It is useful if I want to ...
  • 143
1 vote
1 answer
97 views

Is it possible to disable the "nowrap" option on pymode?

I installed pymode plugin but it overrides my default setting (set wrap). According to :verbose set wrap?, the option is set by pymode. However, I'm not sure if it is possible to override the setting....
  • 527
3 votes
1 answer
1k 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 ...
  • 109
1 vote
2 answers
7k views

Automatic wraping 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
  • 45
1 vote
1 answer
280 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 ...
2 votes
0 answers
61 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
1 answer
90 views

Is there anyway to let cursorline take care of the visual tabs generated by 'breakindent'?

now the cursorline leaves a hideous gap between the number column and the wrapped text, is there any way or trick to make the cursorline take care of the whole part of the wrapped line including the ...
  • 409
4 votes
1 answer
394 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 ...
  • 395
1 vote
0 answers
30 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 ...
  • 111
3 votes
0 answers
68 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 ...
  • 141
1 vote
1 answer
201 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{...