This adds some additional options to the ones set in Debian's /etc/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('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\<tab>" else return "\<c-p>" endif endfunction " Remap the tab key to select action with InsertTabWrapper inoremap <tab> <c-r>=InsertTabWrapper()<cr> filetype on " Enable filetype detection filetype plugin on " function to cleanup a text -> mapped to F5 fun CleanText() let curcol = col(".") let curline = line(".") exe ":retab" exe ":%s/^M$//ge" exe ":%s/^M/ /ge" exe ":%s/ \\+$//e" call cursor(curline, curcol) endfun map <F5> :call CleanText()<CR>
Be sure you make the ^M using “CTRL-V CTRL-M” NOT BY TYPING “CARROT M”!