" default state set nocompatible set modelines=0 enc=utf-8 ffs=unix set ts=4 sw=4 sts=4 shiftround set autoindent smartindent set showmode showcmd laststatus=2 set hidden nowrap number ruler cursorline set ignorecase smartcase hlsearch incsearch showmatch scrolloff=3 set backspace=indent,eol,start set ttyfast lazyredraw vb set wildmenu wildmode=list:longest set foldmethod=syntax foldlevelstart=20 set nobackup noswapfile silent! set undodir=$HOME/.vim/undo undolevels=1000 undoreload=10000 undofile " set color scheme set background=dark silent! colorscheme vividchalk " set leader-key to comma let mapleader="," " clear search nnoremap :noh " remap inconvenient keys inoremap nnoremap vnoremap " shortcut ; to : for less keys nnoremap ; : " toggle paste mode with F2 set pastetoggle=p " quickly edit/reload the vimrc file (,ev or ,sv) nmap ev :e $MYVIMRC nmap sv :so $MYVIMRC " shortcut to force permissions cmap w!! w !sudo tee > /dev/null % " disable noise makers set noeb vb t_vb= " auto syntax highlighting and fold-settings filetype on syntax on filetype indent on filetype plugin on set foldmethod=syntax " define highlight for bad formatting highlight BadWhitespace ctermbg=red guibg=red " define au-group to prevent stacking execution augroup cureall " clear group au! " add markdown file recognition au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown " missing syntax recognition au BufRead,BufNewFile *.py match BadWhitespace /*\t\*/ au BufRead,BufNewFile *.py match BadWhitespace /\s\+$/ " remove trailing whitespace automatically on save au BufWritePre * :%s/\s\+$//e " remove windows carriage returns automatically au BufWritePre * :%s/\r//e augroup END " tab autocompletion function! Tab_Or_Complete() if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w' return "\" else return "\" endif endfunction inoremap =Tab_Or_Complete() set dictionary="/usr/share/dict/words" " load plugins silent! set runtimepath^=$HOME/.vim/bundle/ctrlp.vim silent! :helptags $HOME/.vim/doc