set autochdir set nocompatible " Allow backspacing over everything in insert mode. set backspace=indent,eol,start set number set relativenumber set history=200 " keep 200 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set wildmenu " display completion matches in a status line set ttimeout " time out for key codes set ttimeoutlen=100 " wait up to 100ms after Esc for special key "[Turn backup off and value of history]" set nobackup set noswapfile set history=1000 set nowritebackup set undolevels=5000 "[Define the leader key]" let mapleader="," let maplocalleader="," "[Reselect visual block after indent/outdent]" vnoremap < >gv "[Improve up/down movement on wrapped lines]" "[If preceded by a count, jump actual lines. Also if > 5, save to jumplist]" nnoremap j v:count ? (v:count > 5 ? "m'" . v:count : '') . 'j' : 'gj' nnoremap k v:count ? (v:count > 5 ? "m'" . v:count : '') . 'k' : 'gk' "[Easy split navigation]" nnoremap j nnoremap k nnoremap h nnoremap l nnoremap k nnoremap j nnoremap h nnoremap l "[Locate the desired objects in the center of the screen]" nnoremap n nzz nnoremap N Nzz nnoremap * *zz nnoremap # #zz "[New line under/bellow current line without jump to insert-mode]" nnoremap o o nnoremap O O "[Clear search highlights]" nnoremap // :nohlsearch " Don't use Ex mode, use Q for formatting. map Q gq "[Reflow current paragraph]" "[http://stevelosh.com/blog/2010/09/coming-home-to-vim/]" nnoremap q gqip " Show @@@ in the last line if it is truncated. set display=truncate " Show a few lines of context around the cursor. Note that this makes the " text scroll if you mouse-click near the start or end of the window. set scrolloff=5 let base16colorspace=256 colorscheme base16-default-dark " Do incremental searching when it's possible to timeout. if has('reltime') set incsearch endif " LaTeX ftdetect let g:tex_flavor = "latex" " Switch syntax highlighting on when the terminal has colors or when using the " GUI (which always has colors). if &t_Co > 2 || has("gui_running") " Revert with ":syntax off". syntax on " I like highlighting strings inside C comments. " Revert with ":unlet c_comment_strings". let c_comment_strings=1 endif " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. " Revert with ":filetype off". filetype plugin indent on " Put these in an autocmd group, so that you can revert them with: " ":augroup vimStartup | au! | augroup END" augroup vimStartup au! " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid, when inside an event handler " (happens when dropping a file on gvim) and for a commit message (it's " likely a different one than last time). autocmd BufReadPost * \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' \ | exe "normal! g`\"" \ | endif augroup END endif " has("autocmd")