Skip to content

Instantly share code, notes, and snippets.

@vmunix
Created February 10, 2009 01:57
Show Gist options
  • Save vmunix/61181 to your computer and use it in GitHub Desktop.
Save vmunix/61181 to your computer and use it in GitHub Desktop.
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set background=dark
set title " set xterm title
set history=1000 " keep 1000 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 hidden " let buffers to to background without saving
set wildmenu " for <tab> autocompletion
set wildmode=list:longest,full
set scrolloff=3 " give a little room around the cursor when scrolling
" cleaner backup stuff
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backup " keep a backup file
" case-smart searching
set ignorecase
set smartcase
" Don't use Ex mode, use Q for formatting
map Q gq
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
let python_highlight_all = 1
" let % jump between more than just open and close brackets
runtime macros/matchit.vim
" 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
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab|set softtabstop=4|set smarttab
autocmd FileType ruby set tabstop=2|set shiftwidth=2|set noexpandtab
" 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")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
function Ri()
let b:x = system("ri '" . input("ri: ") . "' > /tmp/ri_output")
sp /tmp/ri_output
endfunction
map <F2> :call Ri()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment