Skip to content

Instantly share code, notes, and snippets.

@eraserhd
Created September 30, 2014 22:08
Show Gist options
  • Select an option

  • Save eraserhd/abba6a700f27a885ffdc to your computer and use it in GitHub Desktop.

Select an option

Save eraserhd/abba6a700f27a885ffdc to your computer and use it in GitHub Desktop.
Current vim RC
" vi:set sts=2 sw=2 ai:
let &runtimepath = pathogen#surround(expand("<sfile>:p:h") . "/.homesick/repos/eraserhd/vimfiles") . "," . &runtimepath
call pathogen#infect()
filetype plugin indent on
set number
set nocompatible bs=2 ai viminfo='20,\"50 modelines=2
set foldmethod=marker nobackup writebackup
set switchbuf=usetab
set listchars=tab:➧•,trail:✗
let mapleader = ","
let maplocalleader = ","
if has('gui_running')
set guioptions=
end
if has('win32') || has('win64')
set guifont=Lucida_Console:h8
set directory=c:\\windows\\temp\\\\
else
set directory=/tmp//
endif
if has('ruby')
ruby $CXX_COMPILER = 'g++'
endif
set grepprg=grep\ -nH
" In block select mode, allow movement past end-of-line
set virtualedit=block
if (&t_Co > 2 || has('gui_running')) && has('syntax')
highlight Normal guibg=black guifg=grey90
set background=dark
syntax on
set hlsearch
highlight MatchParen ctermbg=darkcyan ctermfg=red
endif
map <F1> <Nop>
map gf :split <cfile><CR>
map <F12> ggVG"+y
nmap <leader>f :CtrlP<CR>
func! Eatchar(pat)
let c= nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunc
if has('autocmd')
autocmd BufRead *.txt set tw=78
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup cprog
au!
autocmd BufNewFile,BufRead * set formatoptions=tcql nocindent comments&
autocmd BufNewFile,BufRead *.c,*.cc,*.cpp,*.hh,*.hpp,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,:// sts=4 sw=4 et
autocmd BufNewFile,BufRead *.c set ts=8 sts=8 sw=8 noet
augroup END
augroup objc
autocmd!
autocmd FileType objc,objcpp set cindent ts=4 sts=4 sw=4 et
autocmd BufNewFile ~/src/mobile-iphone-consumer/*Spec.m,~/src/mobile-consumer-ipad/*Spec.m call NewGrouponSpec()
augroup END
augroup scmprog
au!
autocmd BufNewFile,BufRead *.scm,*.sch let b:is_chicken=1
autocmd BufNewFile,BufRead *.scm,*.sch set ft=scheme sts=2 sw=2 autoindent lisp showmatch
augroup END
augroup cljs
autocmd BufNewFile,BufRead *.cljs set ft=clojure
augroup END
augroup javaprog
au!
autocmd BufNewFile,BufRead *.java,*.cs set sts=4 sw=4 cindent et
autocmd BufNewFile,BufRead ~/src/clojure/*.java set ts=2 sw=2 noet
augroup END
augroup pythonprog
au!
autocmd BufNewFile,BufRead *.py set sts=4 sw=4 ai et
augroup END
augroup php
au!
autocmd BufNewFile,BufRead *.inc,*.php,*.php3,*.php4,*.phpt set sts=4 sw=4 ts=4 ai et
autocmd BufNewFile,BufRead *.phpt set ft=php
augroup END
augroup ruby
au!
autocmd BufNewFile,BufRead buildfile set ft=ruby
autocmd FileType ruby set sts=2 sw=2 ai et
augroup END
augroup diff
au!
autocmd BufReadPre *.diff,*.patch set foldmethod=manual
augroup END
augroup eiffel
au!
autocmd BufNewFile,BufRead *.e set sts=2 sw=2 ai et
augroup END
augroup haskell
au!
autocmd BufNewFile,BufRead *.hs set ai et
augroup END
augroup scala
au!
autocmd BufNewFile,BufRead *.scala set filetype=scala sts=2 sw=2 ai et
augroup END
augroup javascript
au!
autocmd BufNewFile,BufRead *.js set sts=2 sw=2 ai et
augroup END
augroup lua
au!
autocmd BufNewFile,BufRead *.lua set sts=2 sw=2 ai et
augroup END
augroup octave
autocmd!
autocmd BufNewFile,BufRead ~/src/mlclass/*.m set ft=octave sts=2 sw=2 ai et
augroup END
augroup cucumber
autocmd!
autocmd FileType cucumber set sts=2 sw=2 ai et
augroup END
augroup ant
autocmd!
autocmd BufNewFile,BufRead build.xml set sts=4 sw=4 ai et
augroup END
augroup html
autocmd!
autocmd BufNewFile,BufRead *.html set sts=2 sw=2 ai et
augroup END
augroup coffee
autocmd FileType coffee set sts=2 sw=2 ai et
augroup END
augroup lisp
autocmd FileType lisp set sts=2 sw=2
augroup END
augroup markdown
autocmd BufNewFile,BufRead *.md,*.markdown set ft=markdown wrap linebreak
augroup END
endif " has('autocmd')
func! GnuC ()
set ts=8 sts=2 sw=2 cindent cinoptions=^-2,p8,{.75s,f0,>4,n-2,:0
endfunc
" Adds a #include (or #import) directive
func! Include(name, directive)
let l:stmt = a:directive . " \"" . a:name . "\""
normal! mh
try
execute "?^#[ ]*\\(import\\|include\\)"
execute "normal! o" . l:stmt
catch
execute "normal! ggi" . l:stmt . "\<CR>"
endtry
normal! `h
endfunc
com! -nargs=1 -complete=file Import :call Include(<q-args>,"#import")
com! -nargs=1 -complete=file Include :call Include(<q-args>,"#include")
if filereadable("./project.vim")
source ./project.vim
endif
command! Gpush :Git push
nmap ,gc :silent Git add -A\|:Gcommit<CR>
let g:CommandTMaxFiles=50000
" Vimux config
let g:VimuxOrientation = "h"
let g:VimuxUseNearestPane = 1
let g:VimuxHeight = "28"
function! RunTests ()
if exists("g:_VimTmuxCmd")
call VimuxRunLastCommand()
return
endif
if filereadable("project.clj")
call VimuxRunCommand("clear; lein test")
elseif filereadable("SKELETOR_CHANGELOG.md")
call VimuxRunCommand("clear; make test")
else
call VimuxPromptCommand()
endif
endfunction
nmap ,, :call RunTests()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment