vimrc
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
vimrc [2008/02/15 01:06] – created 69.134.5.190 | vimrc [2010/08/27 06:55] (current) – 92.195.4.251 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== My ~/.vimrc ====== | ||
+ | This adds some additional options to the ones set in [[Debian]]' | ||
+ | |||
+ | <code vim .vimrc> | ||
+ | " enable syntax highlighting | ||
+ | syntax on | ||
+ | |||
+ | " Highlight redundant whitespaces and tabs. | ||
+ | highlight RedundantSpaces ctermbg=red guibg=red | ||
+ | match RedundantSpaces /\s\+$\| \+\ze\t\|\t/ | ||
+ | |||
+ | " use 4 spaces instead of tabs | ||
+ | set tabstop=4 | ||
+ | set shiftwidth=4 | ||
+ | set expandtab | ||
+ | set softtabstop=4 | ||
+ | |||
+ | " always show ^M in DOS files | ||
+ | set fileformats=unix | ||
+ | |||
+ | " my terminal is white on black | ||
+ | set background=dark | ||
+ | highlight Comment ctermbg=blue | ||
+ | highlight Comment ctermfg=white | ||
+ | |||
+ | " always show line and col number and the current command, set title | ||
+ | set ruler | ||
+ | set showcmd | ||
+ | set title titlestring=vim\ %f | ||
+ | |||
+ | " caseinsensitive incremental search | ||
+ | set ignorecase | ||
+ | set incsearch | ||
+ | |||
+ | " Show matching brackets | ||
+ | set showmatch | ||
+ | |||
+ | " disable any autoindenting which could mess with your mouse pastes (and your head) | ||
+ | " (not useing 'set paste' here to keep fancy stuff like tab completion working) | ||
+ | set nocindent | ||
+ | set nosmartindent | ||
+ | set noautoindent | ||
+ | set indentexpr= | ||
+ | filetype indent off | ||
+ | filetype plugin indent off | ||
+ | |||
+ | " enable php auto folding and remap folding keys to + - (and shift variants) | ||
+ | let php_folding=1 | ||
+ | map + zo | ||
+ | map * zR | ||
+ | map - zc | ||
+ | map _ zM | ||
+ | |||
+ | " This function determines, wether we are on the start of the line text (then tab indents) or | ||
+ | " if we want to try autocompletion | ||
+ | func! InsertTabWrapper() | ||
+ | let col = col(' | ||
+ | if !col || getline(' | ||
+ | return " | ||
+ | else | ||
+ | return " | ||
+ | endif | ||
+ | endfunction | ||
+ | |||
+ | " Remap the tab key to select action with InsertTabWrapper | ||
+ | inoremap <tab> < | ||
+ | filetype on " | ||
+ | filetype plugin on | ||
+ | |||
+ | " function to cleanup a text -> mapped to F5 | ||
+ | fun CleanText() | ||
+ | let curcol = col(" | ||
+ | let curline = line(" | ||
+ | exe ": | ||
+ | exe ": | ||
+ | exe ": | ||
+ | exe ":%s/ \\+$// | ||
+ | call cursor(curline, | ||
+ | endfun | ||
+ | map <F5> :call CleanText()< | ||
+ | </ | ||
+ | |||
+ | Be sure you make the ^M using " |