Please bear with us as we work to restore functionality to dotfiles.org.
" .vimrc
" $Id: .vimrc,v 1.54 2008/10/07 04:58:14 user Exp $
if &diff | setlocal number | endif
"if argc() == 0
" ...
"endif
" Settings {{{1
if v:version >= 600
filetype plugin indent on
endif
if has("folding")
set foldenable
set foldtext=FoldText()
set foldmethod=marker
set foldminlines=2
endif
if &term =~ "rxvt*"
set t_Co=88
elseif &term =~ "xterm"
set t_Co=256
endif
if &t_Co > 2
syntax on
set background=light
endif
let &statusline='%1*%f'
\ . ' %h%m%r%0*'
\ . ' %y'
\ . ' %='
\ . ' %-7.(0x%B%)%<'
\ . ' %-13.(%l/%L,%c%V%)%<'
\ . ' %-7.((%P)%)'
"set autochdir
set autoread
set autowrite
set backspace=eol,start,indent
set backup
set backupdir=$HOME/.vim/backup,$HOME
set browsedir=current
set cmdheight=2
set complete+=k
set completeopt=longest,menuone
set directory=$HOME/.vim/tmp,$HOME/tmp,/tmp
set enc=utf-8
set expandtab
set grepprg=grep\ -nH\ $*
set hidden
set history=1000
set incsearch
set laststatus=2
set listchars=eol:$,tab:^-,trail:.
set mouse=a
set nocp
set noerrorbells
set nohlsearch
set noignorecase
set nolazyredraw
set nomodeline
set nonumber
set novisualbell
set nowrap
set printfont=Lucida_Console:h15
set report=0
set scrolloff=3
set shiftround
set shiftwidth=4
set shortmess=oOtI
set showcmd
set sidescroll=2
set sidescrolloff=3
set smartindent
set smarttab
set softtabstop=4
set t_vb=
set tabstop=4
set textwidth=78
set updatecount=50
set viminfo='20,\"50,:20,%,n~/.viminfo
set whichwrap=h,l,~,<,>,[,]
set wildignore=*~
"set suffixes=.bak,~,.o,.h,.info,.swp,.obj
set wildmenu
"set cursorline cursorcolumn
"set showtabline=2
" Plug-in Settings {{{2
let g:NERDShutUp=1
let g:Tlist_Auto_Open=0
let g:Tlist_Exit_OnlyWindow=1
let g:Tlist_Process_File_Always=1
let g:Tlist_Display_Prototype=1
let g:Tlist_Show_One_File=1
let g:Tlist_GainFocus_On_ToggleOpen=1
let g:showmarks_enable=0
let g:showmarks_textlower=" "
let g:showmarks_textupper=" "
let g:showmarks_textother=" "
let g:showmarks_include="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
let g:DrChipTopLvlMenu='&Plugin.&Align.'
let g:netrw_browse_split=1
let g:GetLatestVimScripts_allowautoinstall=1
" }}}
" }}}
" Functions {{{1
function! Num2S(num, len)
let filler = " "
let text = '' . a:num
return strpart(filler, 1, a:len - strlen(text)) . text
endfunction
function! FoldText()
let sub = substitute(getline(v:foldstart), '/\*\|\*/\|'
\ . strpart(&foldmarker, 0, strridx(&foldmarker, ","))
\ . '\d\=', '', 'g')
let diff = v:foldend - v:foldstart + 1
return '+' . v:folddashes . '[' . Num2S(diff,3) . ']' . sub
endfunction
function! InsertTabWrapper(direction)
let col = col( '.' )-1
if !l:col || getline( '.' )[l:col-1] !~ '\k'
return "\"
elseif "backward" == a:direction
return "\"
else
return "\"
endif
endfunction
function! LoadFileTemplate(name)
let template = $HOME . "/.vim/templates/" . a:name . "." . expand("%:e")
if filereadable(l:template)
silent exe "0r" . template
endif
endfunction
if has ( 'python' )
python <"
endif
" }}}
" Abbreviations {{{1
iabbrev DATE822 =strftime( "%a, %d %b %Y %H:%M:%S %z" )
iabbrev DATE8601 =strftime( "%FT%T%z" )
cabbrev te tabedit
cabbrev tn tabnew
" }}}
" Key mappings {{{1
" piece-wise copying of the line above the current one
inoremap @@@hhkyWjl?@@@P/@@@3s
inoremap =InsertTabWrapper( "forward" )
inoremap =InsertTabWrapper( "backward" )
" carriage return inserts selection when completion menu is visible
inoremap pumvisible() ? "\" : "\u\"
noremap
nnoremap :split __Scratch__
nnoremap :shell
nnoremap :Hexplore
nnoremap :cwindow
nnoremap :cn
nnoremap :cp
nnoremap :!ctags -R --c++-kinds=+p --fields=+iaS
\ --extra=+q %:p
nnoremap :!ctags -R --c++-kinds=+p --fields=+iaS
\ --extra=+q .
nnoremap :!cscope -Rbq:cs add cscope.out:cs
nnoremap :make
nnoremap :set makeprg=gcc\ -Wall\ -g\ -o\ %<\ %
\ :make
nnoremap :!sudo make install
nnoremap :Tlist
nnoremap :Tlisth s:VTreeExplore
\ :set nonul
nnoremap \tc :setlocal invcursorcolumn cursorcolumn?
\ :set invcursorline cursorline?
nnoremap \tp :setlocal invpaste paste?
nnoremap \tf :if &fo =~ 't' setlocal fo-=t
\ else setlocal fo+=t endif setlocal fo?
nnoremap \th :setlocal hls!
nnoremap \ti :setlocal ai!
nnoremap \tl :setlocal list!
nnoremap \tn :setlocal number!
nnoremap \tw :setlocal wrap!
nnoremap \tT :setlocal expandtab!
nnoremap \ts :setlocal spell!
nnoremap \tS :if exists("syntax_on") syntax off else
\ syntax enable endif
nnoremap \xd :%!xxd
nnoremap X
nnoremap \ri :!indent --no-tabs %
" transpose two adjacent words (cursor must be on/before first word)
nnoremap w
\ "_yiw:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/ *N*
nnoremap \u :exec( 'py getUnicodeName()' )
nnoremap M :Man
nnoremap ! :!
nnoremap r :r!
nnoremap ,v :source $MYVIMRC
nnoremap ,b :silent exe "!" . $BROWSER . " file://" .
\ substitute( expand( "%:p " ), "\\", "/", "g" ):mode
nnoremap ,g :silent exe "!" . $BROWSER .
\ " http://www.google.com/search?q=":mode
nnoremap ,= :silent !define less:mode
nnoremap ,I [I:let nr = input( "Which one: " ) exe "normal " . nr .
\ "[\t"
nnoremap ,w :w!
nnoremap ,W :x
nnoremap ,d :bdel
nnoremap ,u :bun
nnoremap ,q :q
nnoremap ,Q :q!
nnoremap ,m :mode
nnoremap t :t
nnoremap \gg ggVG
nnoremap \gy ggyG
nnoremap \= gg=G
nnoremap gf :new %:p:h/
nnoremap ,cd :lcd %:p:h:echo $PWD
nnoremap
nnoremap
vnoremap < >gv
" Autocommands {{{1
if has("autocmd")
if !exists("autocommands_loaded")
let autocommands_loaded=1
au BufReadPost * if line( "'\"" ) | exe "normal '\"" | endif
au BufEnter * lcd %:p:h
au BufNewFile * silent call LoadFileTemplate("main")
augroup asm
au!
au BufNew,BufRead *.asm setlocal syntax=nasm
au BufNew,BufRead *.s setlocal syntax=asm
au FileType asm setlocal tabstop=8 shiftwidth=8
au BufReadPre a.out,*.o,*.obj setlocal syntax=asm ro
au BufReadPost a.out,*.o,*.obj silent %!objdump -D "%"
au BufReadPre a.out setlocal syntax=asm ro
au BufReadPost *.exe silent %!i586-mingw32msvc-objdump -D "%"
augroup END
augroup c
au!
au FileType c,cpp inoremap #if #if #endifbbd0%y00PkA
au FileType c,cpp nnoremap pc
\ :%s:\v//(.*):/*\1 */:
au FileType c,cpp nnoremap cp
\ :%s:/\*\(.\{-\}\)\s*\*/://\1:
au FileType c,cpp nnoremap hi "%phr_I#ifndef
\ gUwyypldwidefine yypldwiendif //
\ O"
augroup END
augroup java
au!
au FileType java setlocal efm=%A\ %#[javac]\ %f:%l:\ %m,%-Z\
\%#[javac]\ %p^,%-C%.%#
au FileType java setlocal makeprg=ant\ -find\ build.xml
augroup END
augroup python
au!
au Filetype python setlocal makeprg=python
\-c\ \"import\ py_compile,sys\"
\-c\ \"sys.stderr=sys.stdout\"
\-c\ \"py_compile.compile(r'%')\"
au Filetype python setlocal efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\
\line\ %l%.%#,%Z%[%^\ ]%\\@=%m
au Filetype python setlocal tags+=$HOME/.vim/tags/python
augroup END
augroup make
au!
au Filetype make setlocal tabstop=8 shiftwidth=8
au Filetype make setlocal noexpandtab
augroup END
augroup txt
au!
au BufReadPre *.txt setlocal filetype=txt
au FileType txt setlocal dictionary+=/usr/share/dict/words
augroup END
augroup pdf
au!
au BufReadPre,FileReadPre *.pdf setlocal ro
au BufReadPost *.pdf silent %!pdftotext -nopgbrk "%" -
\ | fmt -csw78
augroup END
augroup doc
au!
au BufReadPre *.doc setlocal ro
au BufReadPost *.doc silent %!wvText "%" "/dev/stdout"
augroup END
augroup mail
au!
au FileType mail setlocal spell
au FileType mail setlocal dictionary+=/usr/share/dict/words
augroup END
endif
endif
" }}}
" vim: set fenc:utf-8 tw=78 ts=4 sw=4 et fdm=marker: