" Don't make any effort to be compatible with vi, use more sensible settings set nocompatible " Use UTF-8 by default wherever possible, including in this file if has('multi_byte') set encoding=utf-8 scriptencoding utf-8 endif " Load configuration files from ~/.vim/config or its analogue, before Pathogen " loads all its directories into 'runtimepath' runtime! config/*.vim " If our version isn't ancient and Pathogen is available, call it to load all " the plugins in .vim/bundle; these are saved as submodules if v:version >= 701 silent! call pathogen#infect() silent! call pathogen#helptags() endif " Options dependent on the syntax feature if has('syntax') " Use syntax highlighting with 100 lines of context silent! syntax enable silent! syntax sync minlines=100 " Use my custom color scheme if possible, otherwise I'm happy with whatever " the default is, and it usually cares about my background set background=dark silent! colorscheme sahara endif " Don't try to complete strings from included files, just use the strings in " the open buffers; I'll open the file if I want to complete from it set complete-=i " Don't jump my screen around when I join lines, keep my cursor in the same " place; this is done by dropping a mark first and then immediately returning " to it; note that it wipes out your z mark, if you happen to use it nnoremap J mzJ`z " Don't show the Vim startup message, I have registered Vim and donated to " Uganda set shortmess+=I " Let me backspace over pretty much anything, even if it's not text I inserted " in the current session set backspace=indent,eol,start " Don't use modelines at all, they're apparently potential security problems " and I've never used them anyway set nomodeline " Don't assume a number with a leading zero is octal; it's far more likely a " zero-padded decimal, so increment and decrement with ^A and ^X on that basis set nrformats-=octal " Always use forward slashes, I very seldom need to use Vim on Windows for " more than scratch space anyway set shellslash " Allow the cursor to get to the top or bottom of the screen before scrolling " vertically, but set a reasonably wide gutter for scrolling horizontally; no " particular reason, just suits me better set scrolloff=0 set sidescrolloff=16 " Preserve the flags for a pattern when repeating a substitution with &; I don't " really understand why this isn't a default, but there it is nnoremap & :&& vnoremap & :&& " When in visual block mode, let me move the cursor anywhere in the buffer; " don't restrict me only to regions with text if has('virtualedit') set virtualedit+=block endif " Use the tilde as an operator with motions, rather than just swapping the " case of the character under the cursor set tildeop " Change and delete with C and D both cut off the remainder of the line from " the cursor, but Y yanks the whole line, which is inconsistent (and can be " done with yy anyway); this fixes it so it only yanks the rest of the line nnoremap Y y$ " Allow jumping between windows and tabs to find an open instance of a given " buffer with :sbuffer. if v:version >= 701 set switchbuf=useopen,usetab else set switchbuf=useopen endif " Fedora's default environment adds a few auto commands that I don't like, " including the 'return to previous position in buffer' one; fortunately " they're nice enough to group the commands, so I can just clear them if has('autocmd') augroup fedora autocmd! augroup END endif