Customize the settings for the editor vim
The editor
vim
supports a bunch of useful features. You may activate them during a session or set them as your personal default using a text file
~/.vimrc
in your home directory.
![TIP TIP](/pub/System/DocumentGraphics/tip.png)
Please notice that comment lines in
.vimrc
are starting with
"
(instead of the usual
#
).
Enable syntax highlighting
syntax on
Show line numbers
set number
Show relative line numbers
![info](/pub/System/DocumentGraphics/info.png)
The combination of this feature with line numbers is only available at version 7.4.x or newer.
if v:version > 703
set relativenumber
endif
Show trailing whitespaces
:highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+$/
Show matching brackets
set showmatch
Show status line
set showmode
Jump to the last known valid cursor position automatically
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif
Use [F12] for removing trailing spaces in normal and insert mode
nmap <F12> :%s/\s\+$//e<CR>
imap <F12> <ESC><F12>