Skip to content

Instantly share code, notes, and snippets.

@tdavis
Created June 16, 2009 19:16
Show Gist options
  • Save tdavis/130838 to your computer and use it in GitHub Desktop.
Save tdavis/130838 to your computer and use it in GitHub Desktop.
"------------------------------------------------------------------------------
" File: $HOME/.vimrc
" Author: Uwe Hermann <uwe@hermann-uwe.de>
" Author: "jhdf" <http://dotfiles.org/~jhdf/.vimrc>
" Author: Tom Davis <tom@nydusmedia.com>
"------------------------------------------------------------------------------
version 6.3
"------------------------------------------------------------------------------
" Standard stuff.
"------------------------------------------------------------------------------
set hidden " Buffer stuff.
set wildmenu " Tab-completion menu.
set wildmode=list:longest " Match to longest.
set wildchar=<TAB> " Key to start wildmode.
set nocompatible " Disable vi compatibility.
set history=100 " Number of lines of command line history.
set undolevels=200 " Number of undo levels.
set textwidth=0 " Don't wrap words by default.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set showmode " Show current mode.
set ruler " Show the line and column numbers of the cursor.
set ignorecase " Case insensitive matching.
set smartcase " ... except when there is a Cap.
set incsearch " Incremental search.
"set noautoindent " I indent my code myself.
"set nocindent " I indent my code myself.
set scrolloff=5 " Keep a context when scrolling.
set noerrorbells " No beeps.
set visualbell " No beeps, period, dammit!
set modeline " Enable modeline.
set esckeys " Cursor keys in insert mode.
set gdefault " Use 'g' flag by default with :s/foo/bar/.
set magic " Use 'magic' patterns (extended regular expressions).
set tabstop=4 " Number of spaces <tab> counts for.
set ttyscroll=0 " Turn off scrolling (this is faster).
set ttyfast " We have a fast terminal connection.
set hlsearch " Highlight search matches.
set encoding=utf-8 " Set default encoding to UTF-8.
set showbreak=+ " Show a '+' if a line is longer than the screen.
set autowrite " Automatically save before :next, :make etc.
set shortmess=atI " Stifle many interactive prompts.
set nostartofline " Do not jump to first character with page commands.
set viminfo='20,\"50 " Read/write a .viminfo file, don't store more than
" 50 lines of registers.
set iskeyword -=_ " Break motion on underscore.
set whichwrap +=<,>,[,] " Wrap on arrows.
set lazyredraw " Don't redraw on macros, etc.
set report=0 " Report changes.
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start
" Set tags directories
set tags=tags,../tags,~/.vim/tags/*
" Status line
set laststatus=2 " Always show it.
let &statusline = '%-2.2n %t %m' .
\ '%= [%-10.(%{strlen(&filetype)?&filetype:"unknown"}] %)' .
\ '%{&encoding} %4.4{winheight(0)}l %3.3b 0x%-4B ' .
\ '%-10.(%l,%c%V%) %<%P'
" Backups
set backup
let &backupdir = expand('~/.vimbackup')
"------------------------------------------------------------------------------
" Mappings
"------------------------------------------------------------------------------
" Spellcheck.
" map V :!ispell -x %<CR>:e!<CR><CR>
" Fix command typos (stolen from Adam Katz)
nmap ; :
" ` is more useful than ' but less accessible.
nnoremap ' `
nnoremap ` '
" OSX copy/paste from clipboard
vmap <C-c> y:call system("pbcopy", getreg("\""))<CR>
nmap <C-v> :call setreg("\"",system("pbpaste"))<CR>p
" Tabs
map <C-t> <Esc>:tabnew
" These squash
map <C-n> <Esc>:tabn<CR>
map <C-p> <Esc>:tabp<CR>
ab tabnew tabnew
" ROT13 decode/encode the selected text (visual mode).
" Alternative: 'unmap g' and then use 'g?'.
vmap rot :!tr A-Za-z N-ZA-Mn-za-m<CR>
" Make p in visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
" F1: Toggle hlsearch (highlight search matches).
nmap <F1> :set hls!<CR>
" F2: Make.
map <F2> <Esc>:make<CR>
" F3: Toggle expansion of tabs to spaces.
nmap <F3> :set expandtab!<CR>
" F4: Show YankRing
nnoremap <silent> <F4> :YRShow<CR>
" F5: ZoomWin
nnoremap <silent> <F5> :ZoomWin<CR>
" F6: generate ctags.
map <F6> <Esc>:!ctags -R -f tags --totals=yes<CR>
" F12: Comment current line with a #
map <F12> ^i#<Esc>j
"------------------------------------------------------------------------------
" gvimrc
"------------------------------------------------------------------------------
if has('gui_running')
set encoding=utf-8
"set guifont=Monospace\ Bold\ 9
"set guifont=Bitstream\ Vera\ Sans\ Mono\ 8
set guifont=Pragmata\ TT:h11.00
" Turn off toolbar and menu
set guioptions-=T
set guioptions-=m
" Remove antialiasing on fonts
set noantialias
end
colorscheme xoria256
"------------------------------------------------------------------------------
" Correct typos.
"------------------------------------------------------------------------------
" English.
iab beacuse because
iab becuase because
iab acn can
iab cna can
iab centre center
iab chnage change
iab chnages changes
iab chnaged changed
iab chnagelog changelog
iab Chnage Change
iab Chnages Changes
iab ChnageLog ChangeLog
iab debain debian
iab Debain Debian
iab defualt default
iab Defualt Default
iab differnt different
iab diffrent different
iab emial email
iab Emial Email
iab figth fight
iab figther fighter
iab fro for
iab fucntion function
iab ahve have
iab homepgae homepage
iab logifle logfile
iab lokk look
iab lokking looking
iab mial mail
iab Mial Mail
iab miantainer maintainer
iab amke make
iab mroe more
iab nwe new
iab recieve receive
iab recieved received
iab erturn return
iab retrun return
iab retunr return
iab seperate separate
iab shoudl should
iab soem some
iab taht that
iab thta that
iab teh the
iab tehy they
iab truely truly
iab waht what
iab wiht with
iab whic which
iab whihc which
iab yuo you
iab databse database
iab versnio version
iab obnsolete obsolete
iab flase false
iab recrusive recursive
iab Recrusive Recursive
" Days of week.
iab monday Monday
iab tuesday Tuesday
iab wednesday Wednesday
iab thursday Thursday
iab friday Friday
iab saturday Saturday
iab sunday Sunday
" Enable this if you mistype :w as :W or :q as :Q.
nmap :W :w
nmap :Q :q
"------------------------------------------------------------------------------
" Miscellaneous stuff.
"------------------------------------------------------------------------------
" Close scratch window after completion
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
"------------------------------------------------------------------------------
" Functions.
"------------------------------------------------------------------------------
" Tab or completion
function TabComplete()
let col = col('.')-1
if !col || getline('.')[col-1] !~ '\k'
return "\<tab>"
else
return "\<C-X>\<C-O>"
endif
endfunction
"------------------------------------------------------------------------------
" Load file plugins.
"------------------------------------------------------------------------------
if has("autocmd")
" Enabled file type detection and file-type specific plugins.
filetype on
filetype plugin on
filetype indent on
syntax on
endif
"------------------------------------------------------------------------------
" Debian specific options.
"------------------------------------------------------------------------------
" We know xterm-debian is a color terminal.
if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
set t_Co=16
set t_Sf=[3%dm
set t_Sb=[4%dm
endif
"------------------------------------------------------------------------------
" Local settings.
"------------------------------------------------------------------------------
" Source a local configuration file if available.
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
"------------------------------------------------------------------------------
" Plugins
"------------------------------------------------------------------------------
" Set exuberant ctags path
let Tlist_Ctags_Cmd='/usr/local/bin/ctags'
" Set NERDTree to ignore this stuff
let NERDTreeIgnore=['\.pyc$']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment