Skip to content

Instantly share code, notes, and snippets.

@erikh
Created July 19, 2009 07:50
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 erikh/149836 to your computer and use it in GitHub Desktop.
Save erikh/149836 to your computer and use it in GitHub Desktop.
set nocp
set autoindent
set smartindent
set statusline=%F\ \[%M%R\]
set laststatus=2
set titlestring=vim:\ %F\ \[%M%R\]
set title
set number
set hls
set noswf
set foldenable
set foldlevel=0
set foldminlines=5
set nowrap
set term=rxvt
set noincsearch
set expandtab
set tabstop=4
set shiftround
set shiftwidth=4
set smarttab
set softtabstop=4
syntax on
colorscheme elflord
filetype indent plugin on
let perl_extended_vars=1 " Highlight funny variables correctly
let perl_include_pod=1 " Pod highlighting
let perl_fold=1 " Fold Perl constructs by default
let perl_nofold_packages=1 " Not packages, though
let perl_want_scope_in_variables=1 " Highlight variable scope distinctly
let g:sudoAuth="sudo -p 'Password:'"
let g:NERDCreateDefaultMappings=0
let g:netrw_fastbrowse=0
let g:Perl_AuthorName="Erik Hollensbe"
let g:Perl_Email="erik@hollensbe.org"
let g:rails_expensive=1
let g:rails_menu=2
let g:ruby_fold=1
map <C-C> :call RunToBuffer()<CR>
map <F5> :noh<CR>
map <F6> :call ToggleInvPaste()<CR>
map <F7> :set foldmethod=syntax<CR>
" a few filetype specific maps to Ctrl-B for build:
au! BufEnter,BufWinEnter *.texi map <C-B> :!~/bin/texi_build %<CR>
au! BufEnter,BufWinEnter *.rb map <C-B> :!ruby %<CR>
au! BufEnter,BufWinEnter *.pl map <C-B> :!perl -w %<CR>
au! BufEnter,BufWinEnter *.pm map <C-B> :!perl -wc %<CR>
au! BufEnter,BufWinEnter ~/.vimrc map <C-B> :source %<CR>
" filetype specific stuff
syn keyword htmlArg contained onclick
au BufNewFile,BufRead svn-commit.* setf svn
" detect puppet filetypes
au! BufRead,BufNewFile *.pp setfiletype puppet
" ruby
au! BufRead,BufNewFile *.rhtml setfiletype eruby
au! BufRead,BufNewFile [cC]apfile* setfiletype ruby
au! BufRead,BufNewFile [rR]akefile* setfiletype ruby
" interesting functions
fun! ToggleInvPaste()
set invpaste
set paste?
endfun
fun! FindRubySetup()
let curpath = getcwd()."/".bufname("%")
while curpath != ""
let filename = findfile("setup.rb", curpath)
if filename != ""
return curpath
endif
let curpath = substitute(curpath, "/[^/]\\+$", "", "")
endwhile
return ""
endfun
fun! RunRubyTest()
let testpath = FindRubySetup()
execute ":!cd ".testpath.";ruby setup.rb test"
return "Ran tests in: ".testpath
endfun
fun! RunRake()
let target = input("Rake Target: ")
vnew
echo "Running rake ".target." from ".getcwd()
let monkey = append(0, split(system("rake ".target), '\n'))
set ro
set nomod
return ""
endfun
fun! RunToBuffer()
let target = input("Command: ")
if target != ""
vnew
echo "Running command: '".target."' from ".getcwd()
let monkey = append(0, split(system(target), '\n'))
set ro
set nomod
endif
return ""
endfun
fun! RunAck()
let target = input("Regex: ")
if target != ""
Ack(target)
endif
return ""
endfun
vmap u <plug>NERDCommenterUncomment
vmap # <plug>NERDCommenterComment
let mapleader = ","
let maplocalleader = ","
map <Leader>e :Explore<CR>
map <Leader>v :Vexplore<CR>
map <Leader>h :Hexplore<CR>
map <Leader>a :Ack
map <Leader>y :YRShow<cr>
map gv :vsplit <cfile><CR>
map gs :vsplit <cfile><CR>
autocmd BufEnter,BufWinEnter *.pl map <Leader>t :w<cr>:!make test<cr>
autocmd BufEnter,BufWinEnter *.rb map <Leader>rr :call RunRake()<CR>
autocmd BufEnter,BufWinEnter *.rb map <Leader>rd <esc>:!rake rdoc<cr>
autocmd BufEnter,BufWinEnter *.rb map <Leader>rt :call RunRubyTest()<CR>
autocmd BufEnter,BufWinEnter *.rb map <Leader>t :!rake test<CR>
autocmd User Rails set sw=4 sts=4 et
autocmd User Rails map <Leader>rr :Rake<CR>
autocmd User Rails map <Leader>rc :Rcontroller<CR>
autocmd User Rails map <Leader>rm :Rmodel<CR>
autocmd User Rails map <Leader>rv :Rview<CR>
autocmd User Rails map <Leader>rh :Rhelper<CR>
autocmd User Rails map <Leader>rg :Rgenerate<CR>
autocmd User Rails map <Leader>rd :Rdestroy<CR>
autocmd User Rails map <Leader>rft :Rfunctional<CR>
autocmd User Rails map <Leader>rmig :Rmigrate<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment