12 votes

How can I easily create and maintain tables?

If you don't want to install any plugins and you want to edit tables keeping the alignment: -- use the built in VREPLACE mode, activated by gR. (Make sure you has vim latest version, and check if it's ...
rossijonas's user avatar
12 votes
Accepted

Configure which column `gq` wraps at?

You can do this by setting textwidth, and removing t from formatoptions. set textwidth=29 set formatoptions-=t You also need to have the q option enabled in your formatoptions to use gq. It seems to ...
gib's user avatar
  • 260
11 votes
Accepted

How do I wrap the location-list by default (without turning on wrap for files)?

You can indeed use an autocommand: augroup MyStuff autocmd! autocmd FileType qf setlocal wrap augroup END This will affect the quickfix window, too, but I presume that would be desirable. You ...
Rich's user avatar
  • 31.6k
11 votes
Accepted

How to navigate long lines like separate lines?

You can use the gj and gk commands to move the cursor to the character in the next or previous display lines, even when lines wrap. See :help gj and :help gk for details. If you would like to ...
Maxim Kim's user avatar
  • 13.1k
10 votes
Accepted

How to go to the end of the line even in on a wrapped line?

You're looking for g0 and g$ which are the equivalent of 0 and $ for wrapped lines. See :h g0, :h g$ and even :h g^. To quote the doc about g$: When lines wrap ('wrap' on): To the last character ...
statox's user avatar
  • 49.6k
10 votes
Accepted

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

You can set nostartofline to get this. It would also make it stay on the same column while using jumps like gg or G, CTRL-F, L etc. See :h startofline for more details. 'startofline' 'sol' boolean (...
Maxim Kim's user avatar
  • 13.1k
9 votes
Accepted

How do I make Vim respect Markdown headers when formating text?

Since you don't have wrapping for comments enabled, the workaround in this Stack Overflow post can be used: set comments+=n:# set fo+=q This adds # as a comment marker (allowing nesting, so that ##, ...
muru's user avatar
  • 24.8k
7 votes
Accepted

Join all non-blank lines

Maybe it sounds too simplistic, but why not %!fmt -9999
Matt's user avatar
  • 20.6k
7 votes
Accepted

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

If you use the use 'soft wrap' and 'line break` i.e. set wrap set linebreak set textwidth=0 " To avoid confusion with hard wrap Then Vim splits the lines only at the breakat characters. If you ...
Vivian De Smedt's user avatar
6 votes
Accepted

How can I force a page break in MacVim's printed output?

From :help popt-option: formfeed:y When a form feed character is encountered, continue printing of the current line at the beginning of the first line on a new page. So… ...
romainl's user avatar
  • 40k
6 votes
Accepted

How can I make vim's flowing aware of email replies?

From one of my previous answers, you can get this to work if: You have nb:> in your comments setting. And you have q in your formatoptions setting. So: setlocal comments+=nb:> setlocal fo+=q ...
muru's user avatar
  • 24.8k
6 votes

How can I easily create and maintain tables?

I've created the command-line tool tablign for this purpose; it works from within vim as well. Simply install with [sudo -H] pip3 install tablign mark the table in vim and call :'<,'>:!...
Nico Schlömer's user avatar
6 votes

How to stop gVim wrapping text at column 80

As per Kenny Evitt's answer, you can find where textwidth is being set using verbose: :verbose set tw? textwidth=78 Last set from c:\Program Files (x86)\Vim\vim74\vimrc_example.vim If you are ...
Ben Aveling's user avatar
6 votes
Accepted

Vim wrap only current line

I was thinking about this more. You can't wrap just the current line in the current window, but you can open the buffer in a new window and enable wrapping there without affecting your current window....
Tommy A's user avatar
  • 6,750
5 votes

How do I make Vim respect Markdown headers when formating text?

If you're willing to change the way you write your Markdown slightly, you could fix this simply by introducing an extra blank line between your headings and the following text: # this is a h1 this ...
Rich's user avatar
  • 31.6k
5 votes
Accepted

Permission dependent behavior

I think, you can use an BufEnter autocommand, that checks, whether the file is modifiable. Something like this should work (untested): augroup ReadOnly au! au BufEnter * if (!&modifiable ...
Christian Brabandt's user avatar
5 votes

Join all non-blank lines

You were almost there: v/^$/norm vipJ For each matching line it selects the inner paragraph(without following newline) und joins.This works because, the command is only executed for the first line of ...
erba's user avatar
  • 51
5 votes
Accepted

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

Try :h 'list' and :h 'listchars' set list listchars=tab:›\ ,extends:→,precedes:←,nbsp:·,trail:· with list you activate > and < with listchars you can change > and < to other symbols if ...
Maxim Kim's user avatar
  • 13.1k
4 votes

How to stop gVim wrapping text at column 80

In my case, Vitor's comment suggested I run the following: :verbose set tw? Doing so gave me the following output: textwidth=78 Last set from C:\Program Files (x86)\Vim\vim74\vimrc_example....
Kenny Evitt's user avatar
4 votes

Relative Numbers sidepanel with wrapped lines

You state that your current workflow is "inaccurate" and "less usable". You can solve the former (but arguably not the latter) by replacing your current j mapping with: nnoremap <expr> j v:...
Rich's user avatar
  • 31.6k
4 votes

Vim wrap only current line

Soft wrapping per line is not possible. All you can really do is manually wrap the line with gql and undo it after you're done looking. It might not be the exact answer that you're looking for, but ...
Tommy A's user avatar
  • 6,750
4 votes

How to break long line of xml files only on display not in the actual code

You're looking for :h 'wrap': This option changes how text is displayed. It doesn't change the text in the buffer, see 'textwidth' for that. When on, lines longer than the width of the ...
statox's user avatar
  • 49.6k
4 votes
Accepted

Automatic wrapping to new line?

You could work with wrapmargin: set textwidth=0 set wrapmargin=1 set formatoptions+=t set formatoptions-=l The option wrapmargin defines the number of characters from the right window border where ...
Ralf's user avatar
  • 9,147
4 votes

Automatic wrapping to new line?

Set set textwidth=50 The 'textwidth' option can be used to automatically break a line before it gets too long. Set the 'textwidth' option to the desired maximum line length. If you then type ...
Maxim Kim's user avatar
  • 13.1k
4 votes
Accepted

How to wrap lines on hotkey but not automatically?

:set fo-=tc You can set 'formatoptions' with your preferences controlling when and how to format text. See :help fo-table for the list of supported values in this option. In particular, you'll want ...
filbranden's user avatar
  • 28.6k
4 votes

Join all non-blank lines

Normal substitution: %s/\([^\n]\)\n\([^\n]\)/\1 \2/ Substitution with magic mode, so as to drop escaping (): %s/\v([^\n])\n([^\n])/\1 \2/ Explanation: ([^\n]) is any character except a newline in ...
Quasímodo's user avatar
  • 2,426
4 votes
Accepted

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

From :help fo-table we get: c Auto-wrap comments using 'textwidth', inserting the current comment leader automatically. *.txt are given the text filetype, which defines the following option: ...
romainl's user avatar
  • 40k
3 votes
Accepted

Visual indication that lines have been truncated

From vim help (:h listchars) : extends:c Character to show in the last column, when 'wrap' is off and the line continues beyond the right of the screen. precedes:c ...
dNitro's user avatar
  • 401
3 votes

Is there a setting to force a hanging indent on bulleted/numbered lists WITHOUT hard wrapping?

As of Vim 8.2.0139, there are no configuration options to specify this behaviour. Furthermore, any changes to the behaviour of Vim's soft wrapping via 'wrap' will require implementing in the source ...
3 votes
Accepted

soft linewrap width

One non-Ideal solution is open another window and then set the vertical res to 80. The command would be: :vnew | wincmd p | vertical res 80 I know this isn't quite what you had in mind, but it's ...
Tumbler41's user avatar
  • 7,736

Only top scored, non community-wiki answers of a minimum length are eligible