set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start set history=200 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching set nobackup set nowritebackup " Numbers set number set numberwidth=5 " Softtabs, 2 spaces set tabstop=2 set shiftwidth=2 set expandtab set nowrap " Always display the status line set laststatus=2 map Q gq nmap if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on") syntax on set hlsearch 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. filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif augroup END else set autoindent " always set autoindenting on endif " has("autocmd") runtime macros/matchit.vim let fuzzy_matching_limit=10 map t :FuzzyFinderTextMate let g:browser = 'open -a Safari ' " Open the Ruby ApiDock page for the word under cursor, in a new Firefox tab function! OpenRubyDoc(keyword) let url = 'http://apidock.com/ruby/'.a:keyword exec '!'.g:browser.' '.url.' &' endfunction map r :call OpenRubyDoc(expand('')) " Press Shift+P while in visual mode to replace the selection without " overwriting the default register vmap P p :call setreg('"', getreg('0')) " Tab completion options " (only complete to the longest unambiguous match, and show a menu) set completeopt=longest,menu set wildmode=list:longest,list:full set complete=.,t