Created
August 22, 2013 11:12
-
-
Save jballanc/6305942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " We're running Vim, not Vi! | |
syntax on " Enable syntax highlighting | |
filetype off " Disable filetype detection to keep Vundle happy | |
set shiftwidth=2 " That's a good tab width | |
set expandtab " ...and we don't like tab chars | |
set ts=8 " The only tabs we encounter should be in C code | |
set softtabstop=2 | |
set tw=132 " Wrapping to 132, vt100 default | |
set wrap | |
set grepprg=/usr/local/bin/ag " Ag is best | |
set fdm=syntax " Use syntax to define folding | |
set fdls=99 " ...but start off unfolded | |
set autoread " Reread files when they change (i.e. git update) | |
set incsearch " Jump to search results | |
set laststatus=2 " Always display the status line | |
set dir=~/.vim/swap " Put all the swap files in .vim/swap | |
set mouse=a " Enable mouse selection and scrolling in Vim in iTerm | |
set tags=tags,ctags " Sometimes we need an alternate tag file name | |
set cedit=<C-t> " The Vim default of C-F doesn't seem to work | |
" Start up Vundle | |
set rtp+=~/.vim/bundle/vundle | |
call vundle#rc() | |
" Let Vundle manage Vundle | |
Bundle 'gmarik/vundle' | |
" Github Bundles | |
Bundle 'christoomey/vim-tmux-navigator' | |
Bundle 'guns/vim-clojure-static' | |
Bundle 'jpalardy/vim-slime' | |
Bundle 'kchmck/vim-coffee-script' | |
Bundle 'Raimondi/delimitMate' | |
Bundle 'scrooloose/syntastic' | |
Bundle 'tpope/vim-bundler' | |
Bundle 'tpope/vim-dispatch' | |
Bundle 'tpope/vim-endwise' | |
Bundle 'tpope/vim-repeat' | |
Bundle 'tpope/vim-fireplace' | |
Bundle 'tpope/vim-fugitive' | |
Bundle 'tpope/vim-rake' | |
Bundle 'tpope/vim-rails' | |
Bundle 'tpope/vim-surround' | |
Bundle 'vim-ruby/vim-ruby' | |
Bundle 'wlangstroth/vim-racket' | |
Bundle 'xolox/vim-misc' | |
Bundle 'xolox/vim-lua-inspect' | |
" vim-scripts repos | |
Bundle 'bufexplorer.zip' | |
Bundle 'camelcasemotion' | |
Bundle 'cocoa.vim' | |
Bundle 'haskell.vim' | |
Bundle 'Io-programming-language-syntax' | |
Bundle 'luainspect.vim' | |
Bundle 'matchit.zip' | |
Bundle 'The-NERD-tree' | |
Bundle 'omlet.vim' | |
Bundle 'paredit.vim' | |
Bundle 'scala.vim' | |
Bundle 'speeddating.vim' | |
Bundle 'vim-orgmode' | |
Bundle 'YankRing.vim' | |
" Cursor shape for iTerm (with TMUX fix) | |
if !has('gui_running') | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif | |
end | |
" Font and colorscheme | |
set gfn=Menlo:h11 | |
let g:solarized_style="dark" | |
let g:solarized_termcolors=16 | |
colorscheme solarized | |
hi cursor guifg=lightgoldenrod | |
" Quick light/dark color scheme switching | |
function! ToggleView() | |
if (g:solarized_style=="dark") | |
let g:solarized_style="light" | |
set gfn=Menlo:h22 | |
colorscheme solarized | |
else | |
let g:solarized_style="dark" | |
set gfn=Menlo:h11 | |
colorscheme solarized | |
hi cursor guifg=lightgoldenrod,reverse | |
endif | |
endfunction | |
nnoremap <F6> :call ToggleView()<CR> | |
inoremap <F6> <ESC>:call ToggleView()<CR>a | |
vnoremap <F6> <ESC>:call ToggleView()<CR> | |
" Reveal tabs and trailing whitespace | |
set listchars=tab:»·,trail:· | |
set list | |
" Disable scrollbars and toolbar in MacVim | |
set go-=T | |
set go-=r | |
set go-=L | |
" Ctrl-s for easier escaping | |
nnoremap <C-s> <Esc> | |
vnoremap <C-s> <Esc>gV | |
onoremap <C-s> <Esc> | |
inoremap <C-s> <Esc>`^ | |
cnoremap <C-s> <C-c> | |
" Remap leader | |
let mapleader = "," | |
" Useful function for displaying highlight group | |
nmap <leader>h :call SynStack()<CR> | |
function! SynStack() | |
if !exists("*synstack") | |
return | |
endif | |
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') | |
endfunc | |
" A hotkey to kill buffers | |
noremap <C-w>x :bdel<CR> | |
" Readline cursor movement in insert mode | |
noremap! <C-a> <home> | |
noremap! <C-e> <end> | |
noremap! <C-f> <right> | |
noremap! <C-b> <left> | |
noremap! <C-h> <backspace> | |
noremap! <C-d> <delete> | |
" Prevent mistyped :W | |
command W w | |
" Quick way through the fix list | |
nnoremap <silent> <Leader>n :cn<CR> | |
nnoremap <silent> <Leader>p :cp<CR> | |
" MacVim independent tab controls | |
nnoremap <silent> <Leader>to :tabnew<CR> | |
nnoremap <silent> <Leader>tn :tabnext<CR> | |
nnoremap <silent> <Leader>tp :tabprev<CR> | |
nnoremap <silent> <Leader>tx :tabclose<CR> | |
" Remap navigation keys with C-w prefix | |
let g:tmux_navigator_no_mappings = 1 | |
nmap <silent> <C-w>h :TmuxNavigateLeft<CR> | |
nmap <silent> <C-w>j :TmuxNavigateDown<CR> | |
nmap <silent> <C-w>k :TmuxNavigateUp<CR> | |
nmap <silent> <C-w>l :TmuxNavigateRight<CR> | |
nmap <silent> <C-w>w :TmuxNavigatePrevious<CR> | |
" Use JSHint for Javascript syntax checking | |
let g:syntastic_javascript_checkers = ['jshint'] | |
" Vim-Slime should use tmux | |
let g:slime_target = 'tmux' | |
" Customize delimitMate | |
set backspace=indent,eol,start | |
let delimitMate_expand_cr = 1 | |
let delimitMate_expand_space = 1 | |
let delimitMate_balance_matchpairs = 1 | |
au FileType clojure let b:delimitMate_quotes = "\"" | |
au FileType vim let b:delimitMate_quotes = "\'" | |
" Customize YankRing | |
let g:yankring_history_file = '.yankring_history' | |
if has('gui_running') | |
let g:yankring_manual_clipboard_check = 0 | |
else | |
let g:yankring_manual_clipboard_check = 1 | |
end | |
" Customize luainspect | |
let g:lua_inspect_warnings = 0 | |
" Customize CamelCaseMotion | |
map <silent> w <Plug>CamelCaseMotion_w | |
map <silent> b <Plug>CamelCaseMotion_b | |
map <silent> e <Plug>CamelCaseMotion_e | |
" Customize fold line | |
function FoldText() | |
let indent_level = strlen(v:folddashes) - 1 | |
let indent_width = (indent_level * shiftwidth()) - 1 | |
let indent = "+" . repeat(" ", indent_width) | |
let start_line = substitute(getline(v:foldstart), "^\\s*", "", "") | |
let elipsis = "..." | |
let end_line = substitute(getline(v:foldend), "^\\s*", "", "") | |
return indent . start_line . elipsis . end_line | |
endfunction | |
set foldtext=FoldText() | |
" Customize VimClojure | |
let g:clojure_align_multiline_strings = 1 | |
" Clojure Folds! | |
" --------------------------------------------------------------------------- | |
" Automagic Clojure folding on defn's and defmacro's | |
" | |
function GetClojureFold() | |
if getline(v:lnum) =~ '^\s*(defn.*\s' | |
return ">1" | |
elseif getline(v:lnum) =~ '^\s*(def.*\s' | |
return ">1" | |
elseif getline(v:lnum) =~ '^\s*(defmacro.*\s' | |
return ">1" | |
elseif getline(v:lnum) =~ '^\s*(defmethod.*\s' | |
return ">1" | |
elseif getline(v:lnum + 1) =~ '^\s*$' | |
return "<1" | |
else | |
return "=" | |
endif | |
endfunction | |
function TurnOnClojureFolding() | |
setlocal foldexpr=GetClojureFold() | |
setlocal foldmethod=expr | |
endfunction | |
autocmd FileType clojure call TurnOnClojureFolding() | |
" Git commit formatting | |
autocmd Filetype gitcommit setlocal spell textwidth=72 | |
" Now that setup is done... | |
filetype indent plugin on " Enable filetype specific indenting and plugins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment