Skip to content

Instantly share code, notes, and snippets.

@zerotao
Created July 23, 2010 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerotao/487160 to your computer and use it in GitHub Desktop.
Save zerotao/487160 to your computer and use it in GitHub Desktop.
" vim:ft=vim:fdm=marker
"
" Author: Jason L. Shiffer
" Email: jshiffer@zerotao.org
" Copyright: Public Domain 2010
"
" Documentation {{{
"""""""""""""""""""""""""""""""""""""""
" }}}
" General {{{
"""""""""""""""""""""""""""""""""""""""
" let mapleader="," " set the mapleader before any mappings are created
set nocp " disable compat mode
set foldmethod=marker " default fold with markers
set foldlevelstart=0 " default fold everything on open
set foldnestmax=1 " only fold one level deep
set history=300 " limit history
set title " set the title of the terminal
set titleold=""
set visualbell " my desk mates hate the 'bing' ;)
set cmdheight=2 " extend the cmd window at the bottom to 2 lines
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
" set fileencodings=ucs-bom,utf-8,latin1
set fileencodings=utf-8,latin1
set nobomb
endif
if has("spell")
map <F4> :set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR>
highlight PmenuSel ctermfg=black ctermbg=lightgray
set spellsuggest=best,10
endif
" }}}
" Colors and Fonts {{{
"""""""""""""""""""""""""""""""""""""""
syntax on
set background=dark
colorscheme ir_black
"set cursorline
highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=NONE
highlight Comment cterm=NONE ctermfg=darkred ctermbg=NONE guifg=darkred
" }}}
" Files {{{
"""""""""""""""""""""""""""""""""""""""
filetype plugin indent on
set fileformats=unix,dos,mac
" convert spaces to tabs when reading file
" autocmd! bufreadpost * set noexpandtab | retab! 4
"
" " convert tabs to spaces before writing file
" autocmd! bufwritepre * set expandtab | retab! 4
"
" " convert spaces to tabs after writing file (to show guides again)
" autocmd! bufwritepost * set noexpandtab | retab! 4
" }}}
" Text and Indenting {{{
"""""""""""""""""""""""""""""""""""""""
set tabstop=4 " Default tabs to 4 columns
set shiftwidth=4 " <<, >> count for 4 columns
set softtabstop=4 " <tab> key is 4 columns
set expandtab " expand tabs by default
set shiftround " round >,< to multiple of shiftwidth
set autoindent
set smartindent
set copyindent
set preserveindent
set backspace=start,eol,indent
set nopaste " I can turn on paste myself (and it screws up indenting)
set ruler
set textwidth=0 "do not reformat my code automaticly please
set number
"set linebreak
set nowrap " do not wrap lines for me
set encoding=utf8
set listchars=tab:❘-,trail:·,nbsp:×,extends:»,precedes:«
" }}}
" Visual mode {{{
"""""""""""""""""""""""""""""""""""""""
" }}}
" Command mode {{{
"""""""""""""""""""""""""""""""""""""""
" }}}
" Movement {{{
"""""""""""""""""""""""""""""""""""""""
" }}}
" Search {{{
"""""""""""""""""""""""""""""""""""""""
set hlsearch " highlight my search
" clear highlighting
noremap <silent> <C-L> :noh<CR>:redraw!<CR>:syntax sync fromstart<CR>
set ignorecase " case insensitive search
set smartcase " ignore case unless it includes uppercase
set incsearch " search incrementally
" }}}
" Tabs and Buffers {{{
"""""""""""""""""""""""""""""""""""""""
set hidden " just hide buffers when switching away from their window do not close the file
nnoremap <Leader>tc :tabnew<CR>
nnoremap <Leader>tk :tabclose<CR>
nnoremap <Leader>tp :tabprevious<CR>
nnoremap <Leader>tn :tabnext<CR>
nnoremap <Leader>tf :tabfirst<CR>
nnoremap <Leader>tl :tablast<CR>
nnoremap <C-Right> :tabnext<CR>
nnoremap <C-Left> :tabprevious<CR>
" nnoremap <right> :bn<CR>
" nnoremap <left> :bp<CR>
" try
" nunmap <Right>
" nunmap <Left>
" nunmap <Up>
" nunmap <Down>
" catch
" endtry
" }}}
" StatusLine {{{
"""""""""""""""""""""""""""""""""""""""
let g:git_branch_status_head_current=1
let g:git_branch_status_text=""
" let g:git_branch_status_around=""
if has("statusline")
set laststatus=2
" set statusline=%<%f\ %h%m%r%=%k[%{(&fenc\ ==\ \"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}]\ %-12.(%l,%c%V%)\ %P
set statusline=%<%f\ %{GitBranchInfoString()}\ %h%m%r%=%k[%{(&fenc\ ==\ \"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}]\ %-12.(%l,%c%V%)\ %P
" set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%k[%{(&fenc\ ==\ \"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}]\ %-12.(%l,%c%V%)\ %P
hi StatusLineNC ctermfg=lightgray ctermbg=black
endif
try
set switchbuf=usetab
set laststatus=2
catch
endtry
" }}}
" Character Matching (parens and brackets) {{{
"""""""""""""""""""""""""""""""""""""""
" }}}
" Abbrevs {{{
"""""""""""""""""""""""""""""""""""""""
" }}}
" General Mappings {{{
"""""""""""""""""""""""""""""""""""""""
" }}}
" Plugins {{{
"""""""""""""""""""""""""""""""""""""""
set wildmode=list:longest
" Omni Completion {{{
set ofu=syntaxcomplete#Complete
" }}}
" VCS {{{
" If this is enabled then look at the statusline above
" let VCSCommandEnableBufferSetup=1 " slows down startup toooooo much
augroup VCSCommand
au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
augroup END
" }}}
" NERDTree {{{
noremap <special> <F2> :NERDTreeToggle<CR>
" }}}
" NERDCommenter {{{
let NERDSpaceDelims=1 " make sure there is a space around commented code
" }}}
" Tag List {{{
noremap <special> <F3> :TlistToggle<CR>
let Tlist_Close_On_Select=1
let Tlist_GainFocus_On_ToggleOpen=1
" }}}
" Fuzzy Find {{{
let g:fuf_mrufile_maxItem = 300
let g:fuf_mrucmd_maxItem = 400
" noremap <silent> g] :FufTagWithCursorWord!<CR>
nnoremap <silent> <Leader>ff :FufFileWithCurrentBufferDir<CR>
nnoremap <silent> <Leader>fd :FufDirWithCurrentBufferDir<CR>
nnoremap <silent> <Leader>fb :FufBuffer<CR>
nnoremap <silent> <Leader>fh :FufHelp<CR>
nnoremap <silent> <Leader>fc :FufMruCmd<CR>
nnoremap <silent> <Leader>fB :FufBookmark<CR>
nnoremap <silent> <Leader>ft :FufTagWithCursorWord<CR>
nnoremap <silent> <Leader>fT :FufTaggedFile<CR>
nnoremap <silent> <Leader>fj :FufJumpList<CR>
nnoremap <silent> <Leader>fC :FufChangeList<CR>
nnoremap <silent> <Leader>fl :FufLine<CR>
" }}}
" Screen Shell {{{
let g:ScreenShellHeight = 10
" }}}
" Snippets {{{
let g:snips_author = 'Jason L. Shiffer <jshiffer@zerotao.org>'
let g:snips_company = 'Jason L. Shiffer'
let g:snips_copyright = g:snips_company
" }}}
" Abbreviations {{{
ab mcorp MANDIANT
ab mauthor Jason L. Shiffer <jason.shiffer@mandiant.com>
ab zcorp ZeroTao LLC
ab zauthor Jason L. Shiffer <jshiffer@zerotao.org>
ab ztauthor Jason L. Shiffer <jshiffer@zerotao.com>
" }}}
" BufExplorer {{{
let g:bufExplorerFindActive=0
" }}}
" Utl {{{
if has("macunix")
let g:utl_cfg_hdl_scm_http_system='silent !open "%u"'
let g:utl_cfg_hdl_scm_mt_system='silent !open "%u"'
endif
"" }}}
" Kwbd {{{
nmap <C-W>! <Plug>Kwbd
" }}}
" }}}
" Functions {{{
""""""""""""""""""""""""""""""""""""""""
" diff against on disk version
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis
endif
if !exists(":Uncrustify")
command! -range -bang -nargs=0 Uncrustify <line1>,<line2>!uncrustify -c ~/.uncrustify.cfg -lC -q
endif
" }}}
" Auto Commands {{{
"""""""""""""""""""""""""""""""""""""""
if !exists("autocommands_loaded")
let autocommands_loaded=1
au BufEnter * :syntax sync minlines=200
au BufNewFile,BufRead *.m set ft=objc
au BufNewFile,BufRead *.txt set ft=rst textwidth=78
au BufNewFile,BufRead *.py setlocal expandtab foldmethod=indent
au BufNewFile,BufRead *.[ch] set cindent foldmethod=syntax
au BufNewFile,BufRead *.cmake,CMakeLists.txt set ft=cmake
au BufNewFile,BufRead *.sl set ft=lisp
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" disable cursorline in windows we are not in
au WinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
endif
" }}}
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment