CromeDome's .vimrc

From xoa

Jump to: navigation, search

(This is what it looks like - Jason)

"
" To make my own life easier, here's the list of keymappings provided by my
" setup:
"
" F1 - Previous file in buffer list
" F2 - Next file in buffer list
" F3 - Perldoc on the selected module
" F4 - Perldoc on the selected function
" F5 - Run the Perl compiler on the current file
" F6 - List all Perl compiler errors
" F7 - Previous Perl compiler error
" F8 - Next Perl compiler error 
"
" (F9 and above are used by OS X to control various interface elements, namely
" Expose' and Dashboard).
"
" (these don't work in Terminal, and right now, I don't care why)
" Shift-F1   - Toggles paste mode
" Shift-F2   - Toggles the project browser
" Shift-F3   - Toggles the tabbed explorer bar
" Shift-F4   - Toggles the taglist (using ctags)
" Control-F1 - Run perltidy on the currently edited file or selection
"
" (these do work in Terminal though...)
" ,pb - Toggles the project browser
" ,tb - Toggles the tabbed explorer bar
" ,tl - Toggles the taglist (using ctags)
" ,pt - Run Perltidy on the currently edited file or selection
"
" Other useful commands:
" Control-A-# - Switch to buffer #
" Control-C - Comment selected lines
" Control-X - Uncomment selected lines
" --n - Insert name
" --e - Insert email address
" --w - Insert work email address
" --r - Insert revision tag
" 
" Most of this was shamelessly stolen from rjbs.  Extra help from David Hand.
"
" Plugins used:
" - comments.vim (block commenting made easy)
" - minbufexpl (for a tab-like interface to buffers)
" - perl.vim (another interface to the Perl compiler)
" - perlhelp (Perldoc interface)
" - perl_synwrite (syntax-checks Perl before saving - use :W)
" - project (provides a project/tree explorer)
" - screen.vim (for screen-like buffer bindings)
" - taglist.vim (provides selectable list of subs using ctags)
"

"
" This has a potential effect on all the following options...
"
set nocompatible         " disable vi compatibility

"
" Set vim options
"
set autoindent           " carry over indenting from previous line
set backspace=2          " allow backspace beyond insertion point
set background=dark      " console bg is dark
set backupdir=/tmp       " put backups in /tmp
set backupdir-=.         " ...and not in cwd
set cinkeys-=0#          " don't unindent cpp stuff (perl comments!)
set clipboard+=unnamed   " put yanks/etc on the clipboard
set comments=b://,b:#    " by default allow C++ (JS) and generic unixy comments
set com+=s1:/*,mb:*,ex:*/  " ...and also C-style comments
set copyindent           " make autoindent use the same characters to indent
set directory=/tmp       " store temp files someplace out of the way
set directory-=.         " . . .and don't store temp files in cwd
set encoding=utf-8       " unicode
set expandtab            " spaces, not tabs!
set foldcolumn=0         " no fold column
set foldlevelstart=0     " start with all folds closed
set formatoptions=r      " r - re-insert comment leader on newline
set guioptions+=agimrLt  " make vim act like a gui when started like one
set hidden               " hide, don't close, undisplayed buffers
set history=50           " keep 50 lines of command history
set laststatus=2         " always show status line
set more                 " page on extended output
set novb                 " disable visual bell
set nowrap               " don't automatically wrap lines
set number               " turn on line numbering
set path=.,$HOME,,       " for editing with :find
set pastetoggle=<S-F1>   " Shift-F1 to toggle paste
set report=1             " Always report changes
set ruler                " display cursor position
set showcmd              " show command-in-progress
set showmode             " show the current input mode
set showmatch            " Automagically show matching brackets
set shiftwidth=4         " four spaces per sw
set softtabstop=4        " make four spaces act like tabs
set tabstop=4            " The One True Tab (as of latest revision)
set terse
set timeout              " allow keys to timeout
set title                " do set the xterm title (see 'titleold', set below)
set undolevels=1000      " LOTS of undo history
set wildignore+=*/CVS/   " don't try to descend into CVS directories
set wildignore+=*/SVN/   " don't try to descend into SVN directories
set wildmenu             " enable menu of completions
set wildmode=longest:full,full 
                         " complete only as much as is common,
                         " then show menu
set writeany             " avoid constant ! to overwrite. . .

colorscheme cromedome    " use my phat color scheme
filetype plugin on       " use ftplugins, mostly for those in ~
syntax on                " enable syntax highlighting

if has("win32")
	let Tlist_Ctags_Cmd='C:\Progra~1\ctags\ctags.exe'
	map <M-Space> :simalt ~<CR>
elseif has("macunix")
	" the Carbon clipboard is screwed up, and messes up newlines
	set cb=
endif

" exec'd because ... could it work otherwise?
exec "set titleold=" . matchstr(hostname(), "^[^.]\\+")

" use a UTF-8 term if you can
if $TERM_PROGRAM == "Apple_Terminal"
  set tenc=utf-8
endif

"
" Arrow macros
"
map! ^K ^VESCO
map! ^VESC^B ESCbi
map! ^VESC^F ESCEa
map! ^VESCOA ^VESCka
map! ^VESCOB ^VESCja
map! ^VESCOC ^VESClli
map! ^VESCOD ^VESCi
map ^V^? x
map ^VESCOH 0
map ^VESCOF $
map ^VESC[H 0
map ^VESC[F $
map [H I
map [F A

"
" Use fonts that don't make my eyes bleed
"
if has("gui_running")
    if has("macunix")
        set guifont=ProFont:h9
    elseif has("win32")
        set guifont=ProFontWindows:h11:b:cANSI,Lucida_Console:h11:b:cANSI
    elseif has("x11")
        set guifont=-jmk-neep-bold-r-normal--15-*-*-*-*-*-*-*
    endif
endif

"
" Act more like a pager when invoked as one
"
if (v:progname == "view")
    nmap <Space> <PageDown>
    nmap b       <PageUp>
    nmap q       :q<CR>
endif

"
" Configure status line
"
function ModifiedFlag()
	if (&modified)
		return "*"
	else
		return " "
	endif
endfunc

set statusline=[%n]\ %{ModifiedFlag()}%f\ %=%h%r%w\ (%v,%l)\ %P\ 

"
" Perl code folding options
"
let perl_fold=1
let perl_include_pod=1

"
" Because I don't like to type much. . . 
"
iabbr --r -- Jason, <C-R>=strftime("%Y-%m-%d")<CR>
iabbr --n Jason A. Crome
iabbr --e cromedome@cpan.org
iabbr --w crome@devnetinc.com

" 
" Version 7 things
"
if v:version >= 700
    nnoremap @ :set cursorcolumn! cursorline!<CR>
    let loaded_matchparen = 1
endif

"
" Plugin configuration!
"

" perl_synwrite
silent call system("perl -e0 -MVi::QuickFix=silent")
let perl_synwrite_qf = ! v:shell_error   " use Vi::QuickFix if it can be used

" Perl compiler settings
autocmd BufNewFile,BufRead *.p? compiler perl
autocmd BufNewFile,BufRead *.t  compiler perl

map <F5> :make<CR>
map <F6> :clist<CR>
map <F7> :cprevious<CR>
map <F8> :cnext<CR>

" minibufexplorer settings
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplSplitBelow=0
let g:miniBufExplDebugLevel=0
map <F1> :MBEbp<cr>
map <F2> :MBEbn<cr>
map <S-F3> :TMiniBufExplorer<cr>
map <silent> ,tb :TMiniBufExplorer<CR>

" Project settings
let g:proj_window_width = 50
nmap <silent> <S-F2> <Plug>ToggleProject
map <silent> ,pb <Plug>ToggleProject

" ctags settings
set tags=tags
let Tlist_Ctags_Cmd='/opt/local/bin/ctags'
let Tlist_Inc_Winwidth=0
let Tlist_Show_One_File=1
let Tlist_Exist_OnlyWindow=1
let Tlist_Use_Right_Window=1
let Tlist_Sort_Type="name"
let Tlist_Display_Prototype=0
let Tlist_Compact_Format=1 " Compact?
let Tlist_GainFocus_On_ToggleOpen=1
let Tlist_Display_Tag_Scope=1
let Tlist_Close_On_Select=0
let Tlist_Enable_Fold_Column=0
let TList_WinWidth=50
map <S-F4> :TlistToggle<CR>
map <silent> ,tl :TlistToggle<CR>

" perldoc settings
let perlhelp_prog='/usr/bin/perldoc'
nmap <silent> <unique> ,pf <Plug>PerlHelpFuncNormal
vmap <silent> <unique> ,pf <Plug>PerlHelpFuncVisual
nmap <silent> <unique> ,pm <Plug>PerlHelpModNormal
vmap <silent> <unique> ,pm <Plug>PerlHelpModVisual
nmap <silent> <unique> <F3> <Plug>PerlHelpModNormal
vmap <silent> <unique> <F3> <Plug>PerlHelpModVisual
nmap <silent> <unique> <F4> <Plug>PerlHelpFuncNormal
vmap <silent> <unique> <F4> <Plug>PerlHelpFuncVisual

" perltidy settings
nnoremap <silent> ,pt :%!perltidy -q<Enter>
vnoremap <silent> ,pt :!perltidy -q<Enter>
nnoremap <silent> <C-F1> :%!perltidy -q<Enter>
vnoremap <silent> <C-F1> :!perltidy -q<Enter>
Personal tools