set nocompatible set modelines=0 " for security set encoding=utf-8 set mouse="" set backspace=indent,eol,start au FocusLost * :wa " Leader ====---- nnoremap ,, , let mapleader="," nnoremap ; ; nnoremap ; : " Highlighting ====---- syntax on filetype plugin indent on set t_Co=256 " enable 256-color mode. if &t_Co >= 256 || has("gui_running") "colorscheme mustang "colorscheme desert " set colorscheme endif if &t_Co > 2 || has("gui_running") " switch syntax highlighting on, when the terminal has colors syntax on endif " Indentation ====---- set shiftwidth=2 set tabstop=2 set expandtab set shiftround " use multiple of shiftwidth with '<' and '>' set autoindent set copyindent " copy the previous line's indentation " Search ====---- set incsearch set hlsearch set wrapscan set ignorecase " ignore case when searching set smartcase " ignore case if search pattern is all lowercase, " case-sensitive otherwise nnoremap :noh " Case insensitive nnoremap * /\<=expand('')\> nnoremap # ?\<=expand('')\> set showmatch nnoremap % vnoremap % " Screen ====---- "set nowrap set wrap "set textwidth=79 "set formatoptions=tqrn1 set colorcolumn=85 set ruler "set number " always show line numbers set relativenumber set laststatus=2 set cursorline "set showmode set showcmd set title " change the terminal's title set scrolloff=3 set visualbell " don't beep set noerrorbells " don't beep set list set listchars=tab:>.,trail:.,extends:#,nbsp:. "autocmd filetype html,xml set listchars-=tab:>. set wildmenu set wildmode=longest:full,full set wildignore=*.swp,*.bak,*.pyc,*.class set ttyfast " Stop using arrow keys ====---- nnoremap nnoremap nnoremap nnoremap inoremap inoremap inoremap inoremap " nnoremap j gj " nnoremap k gk " Splits ====---- nnoremap w vl split nnoremap h nnoremap j nnoremap k nnoremap l " History ====---- set history=1000 " remember more commands and search history set undolevels=1000 " use many muchos levels of undo if !isdirectory($HOME."/.vim") call mkdir($HOME."/.vim", "", 0770) endif if !isdirectory($HOME."/.vim/undo-dir") call mkdir($HOME."/.vim/undo-dir", "", 0700) endif set undodir=~/.vim/undo-dir set undofile " !!!! ADD THIS TO CRONTAB " 43 0 * * 3 find /home/adam/.vim/undo-dir -type f -mtime +90 -delete set nobackup set noswapfile " Note: swap helps large files. " Custom mappings ====---- " Quickly edit/reload the vimrc file nnoremap ev :e $MYVIMRC nnoremap sv :so $MYVIMRC set pastetoggle= nnoremap W :%s/\s\+$//:let @/='' " strip trailing whitespace nnoremap ft Vatzf " fold tag nnoremap S ?{jV/^\s*\}?$k:sort:noh " sort CSS nnoremap q gqip " re-hardwrap nnoremap v V`] " select pasted vnoremap Q gq nnoremap Q gqap cnoremap w!! w !sudo tee % >/dev/null