man vim
vimtutor
:highlight in syntax.txt
:set textwidth=80 linebreak
Format a bunch of text.
select some lines
gq
Format the current paragraph without selecting first.
gqip
Format all paragraphs in the current file without selecting first.
gggwG
but you lose your cursor position unfortunately.
AUTOMATIC text formatting DOES NOT WORK!!! DISPLAY ONLY!
If you want to display the vertical ruler, select:
:set colorcolumn=80
or
:set cc=80
Help pages for:
:help colorcolumn
If you want to highlight the entire area outside the column boundary, select:
let &colorcolumn = join(range(81,999), ',')
If you want to highlight characters past a certain column boundary, select:
:match Error /\%>80c/
Vim doesn't use transparency for the color settings, in this case you are setting the color to ANSI 1, or Red. If the syntax highlighting on top is close to the same color it will be hard to read.
On my system I have the background and black configured slightly different so find good results by using ANSI 16:
:highlight ColorColumn ctermbg=16
Or if you have a 256 color terminal:
:highlight ColorColumn ctermbg=235
:highlight ColorColumn ctermbg=232
:highlight ColorColumn ctermbg=238
Colors listed here:
Help pages for:
:help highlight
You might also start with a colorscheme where the hard work has been done for you.
:colorscheme zellner
or
:colorscheme desert
All standard color schemes:
ls /usr/share/vim/vim81/colors
Open file:
vi ~/.vimrc
Paste the settings into the file:
set nocompatible
set backspace=indent,eol,start
set paste
set mouse=a
set number " line number
set showcmd " count the number of characters in a line, with v or V
set linebreak
let &colorcolumn=join(range(81,999), ',')
highlight ColorColumn ctermbg=235
syntax enable " enable colorscheme mariana
colorscheme mariana
Save and close:
:wq
Reload .vimrc:
:so %
or
:so ~/.vimrc
Back | Modified , email |