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 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 The combination of this feature with line numbers is only available at version 7.4.x or newer.
if v:version > 703
 set relativenumber

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

Use [F12] for removing trailing spaces in normal and insert mode

nmap <F12> :%s/\s\+$//e<CR>
imap <F12> <ESC><F12>
Topic revision: r3 - 2016-10-24, StefanHaller - This page was cached on 2021-03-04 - 20:08.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Imprint (german) | Privacy Policy (german)