Skip to main content

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
1 vote
2 answers
60 views

Vertically center the cursor on soft-wrapped lines

When writing LaTeX, I try to stick to one sentence per line to make my text work well with diffs, as is commonly accepted practice. Because I have to use a very large font size, nearly every sentence ...
TheGiwi's user avatar
  • 47
1 vote
2 answers
180 views

How to soft wrap text at column number lower than window width?

I developed prompter.vim, a vim plugin that autocomplete buffer text using LLMs completions. The completion is a multi-line text insertion appended at the end to the buffer. I would like to have ...
Giorgio Robino's user avatar
1 vote
0 answers
21 views

How can I create a popup at a given buffer line and column when the wrap option is set?

When you do popup_create({whatever}, #{ line: m, col: n}), m and n are meant to be screen column numbers, as per :help popup_create-arguments. But what if I want to position the popup at a specific ...
Enlico's user avatar
  • 2,194
2 votes
1 answer
2k views

How can I make (Neo)Vim wrap lines in respect to indentation?

Currently, indented lines will wrap all the way to the left of the text area. This is what they look like: This is a long line of text that is indented wi th tabs. In order for it to properly fit ...
natalie's user avatar
  • 23
0 votes
1 answer
106 views

Vimwiki bullet point wrapping creates a new line

When I use vimwiki and I write past the text width, the bullet point will wrap. This is what I expect. However, the wrap will be a new line: 1. something to say ..... a second line wrapped after ...
Vinn's user avatar
  • 781
8 votes
1 answer
505 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 ...
John Gordon's user avatar
0 votes
1 answer
77 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 ...
Aaron Parisi's user avatar
4 votes
1 answer
84 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 ...
Enlico's user avatar
  • 2,194
2 votes
1 answer
215 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 ...
user90726's user avatar
  • 123
8 votes
1 answer
448 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 ...
user90726's user avatar
  • 123
5 votes
1 answer
129 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: ...
john c. j.'s user avatar
2 votes
1 answer
355 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, ^,...
Enlico's user avatar
  • 2,194
5 votes
1 answer
75 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 ...
CLAUDE's user avatar
  • 151
1 vote
1 answer
46 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 ...
I.P's user avatar
  • 13
1 vote
1 answer
43 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, ...
user90726's user avatar
  • 123
3 votes
1 answer
197 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 ·: ···/...
ELLIOTTCABLE's user avatar
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
3 votes
1 answer
207 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 ...
chaffdog's user avatar
  • 131
2 votes
1 answer
310 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 ...
Andrew.Wolphoe's user avatar
1 vote
1 answer
105 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 ...
user90726's user avatar
  • 123
0 votes
1 answer
458 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 ...
Marco Andreolli's user avatar
4 votes
1 answer
462 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
2 votes
1 answer
186 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 ...
tejasvi88's user avatar
  • 470
4 votes
1 answer
1k 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'...
Enlico's user avatar
  • 2,194
1 vote
1 answer
166 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, ...
berkes's user avatar
  • 113
1 vote
1 answer
93 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?
Enlico's user avatar
  • 2,194
0 votes
1 answer
826 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-...
Biff's user avatar
  • 109
1 vote
0 answers
59 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 ...
Shadow43375'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
3 votes
1 answer
1k 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 ...
Simon Alford's user avatar
0 votes
1 answer
132 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 ...
ecjb's user avatar
  • 149
0 votes
0 answers
24 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 ...
Anas sheshai's user avatar
7 votes
1 answer
1k 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 ...
Biggybi's user avatar
  • 2,740
0 votes
0 answers
23 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 ...
Biggybi's user avatar
  • 2,740
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 ...
Luís de Sousa's user avatar
2 votes
1 answer
900 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 ...
Jorge Romeu's user avatar
2 votes
1 answer
103 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 ...
Mateen Ulhaq's user avatar
3 votes
0 answers
357 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
2 votes
1 answer
719 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 ...
myc3lium's user avatar
6 votes
2 answers
2k 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 ...
frakk's user avatar
  • 63
1 vote
0 answers
37 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 ...
User9102d82's user avatar
5 votes
1 answer
3k 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 ...
Shersh's user avatar
  • 153
1 vote
1 answer
109 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....
Blaszard's user avatar
  • 555
4 votes
1 answer
2k 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 ...
james's user avatar
  • 139
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
2 votes
0 answers
78 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
0 votes
1 answer
100 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 ...
tga's user avatar
  • 419
4 votes
1 answer
477 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 ...
rwolst's user avatar
  • 405
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 ...
pranphy's user avatar
  • 111