" Being vi-compatible disables more advanced features set nocompatible " Clear all existing autocommands first to avoid unwanted side effects if has("autocmd") autocmd! endif " Register plugins if filereadable(expand("~/dotfiles/vim/plugins.vim")) source ~/dotfiles/vim/plugins.vim endif " Automatically detect file types. filetype plugin indent on " Syntax highlighting. syntax on """""""" "" Tabs and Text Formatting """""""""""""""""""""""""""""""""""""""""""""""""""""" set nowrap set cursorline " Highlight current line set expandtab " convert tab characters into spaces set tabstop=2 " actual tab press distance set softtabstop=2 " let backspace delete by indents set shiftround " indent to nearest tabstops set shiftwidth=2 " amount to indent with > and < set smarttab " backspace tabs where appropriate even if spaces set textwidth=80 " try to keep text within 80 characters set colorcolumn=+1 " mark out the limits of the textwidth set hidden " allow changing buffers without unsaved-warnings e.g. for argdo set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) set splitright " Puts new vsplit windows to the right of the current set splitbelow " Puts new split windows to the bottom of the current set backspace=indent,eol,start " Backspace for dummies set linespace=0 " No extra spaces between rows set number " Line numbers on set relativenumber set showmatch " Show matching brackets/parenthesis set incsearch " Find as you type search set hlsearch " Highlight search terms set winminheight=0 " Windows can be 0 line high set ignorecase " Case insensitive search set smartcase " Case sensitive when uc present set wildmenu " Show list instead of just completing set modeline " Support vim modelines at the top of files set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter') set scrolloff=5 " Minimum lines to keep above and below cursor set list set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace if has('persistent_undo') set undofile " So is persistent undo ... set undolevels=1000 " Maximum number of changes that can be undone set undoreload=10000 " Maximum number lines to save for undo on a buffer reload endif """""""" "" Key Remaps """""""""""""""""""""""""""""""""""""""""""""""""""""" let mapleader = ',' " More convenient escape inoremap kj inoremap jk " Yank from the cursor to the end of the line, to be consistent with C and D. nnoremap Y y$ " Remap vim's 'increment next number' to since is used by tmux. nnoremap " Allow using the repeat operator with a visual selection (!) " http://stackoverflow.com/a/8064607/127816 vnoremap . :normal . """""""" "" Load Settings Files """""""""""""""""""""""""""""""""""""""""""""""""""""" for filePath in split(globpath('~/dotfiles/vim/settings', '*.vim'), '\n') execute 'source' filePath endfor