" Being vi-compatible disables more advanced features set nocompatible " Clear all existing autocommands first to avoid unwanted side effects if has("autocmd") autocmd! " Automatically detect file types. filetype plugin indent on endif " Syntax highlighting. if has("syntax") syntax enable endif 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 mouse=a " Mouse support enabled. 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 relativenumber " Show line numbers relative to current line, and set number " Show the actual line number on current line. set showmatch " Show matching brackets/parenthesis set incsearch " Find as you type search set hlsearch " Highlight search terms set ignorecase " Case insensitive search set smartcase " Case sensitive when uc present set winminheight=0 " Windows can be 0 line high 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 (reduces 'hit enter') set scrolloff=5 " Minimum lines to keep above and below cursor set sidescroll=1 set sidescrolloff=10 set linebreak " Break on words when wrapping. set list set listchars=tab:>\ ,trail:_,extends:#,nbsp:# " Persistent undo is great! if has('persistent_undo') set undofile set undolevels=1000 " Max changes that can be undone set undoreload=10000 " Max lines to save for undo on a buffer reload endif " Join (J) options set nojoinspaces " Prevents inserting two spaces after punctuation if v:version > 703 || v:version == 703 && has("patch541") set formatoptions+=j " Remove comment characters when joining comment lines. endif """""""" "" Mappings """""""""""""""""""""""""""""""""""""""""""""""""""""" let mapleader = ' ' " Save changes to a file nmap w :up " Close a file nmap q :q " 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 Plugins """""""""""""""""""""""""""""""""""""""""""""""""""""" if filereadable(expand("~/dotfiles/vim/plugins.vim")) source ~/dotfiles/vim/plugins.vim endif """""""" "" Load Settings Files """""""""""""""""""""""""""""""""""""""""""""""""""""" for filePath in split(globpath('~/dotfiles/vim/settings', '*.vim'), '\n') execute 'source' filePath endfor