Created
March 4, 2015 09:16
-
-
Save jballanc/64746228905103d6671a 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 softtabstop=2 | |
set tw=90 " 90 chars fits two columns on my screen | |
set wrap | |
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 ttymouse=xterm2 " Extended mouse support for window resizing in tmux | |
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 vim-plug | |
call plug#begin('~/.vim/bundle') | |
" Plugins | |
Plug 'bkad/CamelCaseMotion' | |
Plug 'christoomey/vim-tmux-navigator' | |
Plug 'corntrace/bufexplorer' | |
Plug 'elzr/vim-json' | |
Plug 'guns/vim-slamhound' | |
Plug 'jballanc/YankRing.vim' | |
Plug 'JuliaLang/julia-vim' | |
Plug 'jpalardy/vim-slime' | |
Plug 'kovisoft/paredit' | |
Plug 'nvie/vim-flake8' | |
Plug 'Raimondi/delimitMate' | |
Plug 'rking/ag.vim' | |
Plug 'rkneufeld/vim-boot' | |
Plug 'The-NERD-Tree' | |
Plug 'tpope/vim-dispatch' | |
Plug 'tpope/vim-endwise' | |
Plug 'tpope/vim-fireplace' | |
Plug 'tpope/vim-fugitive' | |
Plug 'tpope/vim-leiningen' | |
Plug 'tpope/vim-markdown' | |
Plug 'tpope/vim-repeat' | |
Plug 'tpope/vim-surround' | |
Plug 'typedclojure/vim-typedclojure' | |
Plug 'vim-ruby/vim-ruby' | |
Plug 'xolox/vim-misc' | |
Plug 'xolox/vim-lua-inspect' | |
call plug#end() | |
" Now that Vundle is done... | |
filetype indent plugin on " Enable filetype specific indenting and plugins | |
" 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 | |
set t_Co=16 | |
hi cursor guifg=lightgoldenrod | |
colorscheme solarized | |
" 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 | |
" 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 and :Q | |
command! W w | |
command! Q q | |
" 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> | |
"Open tags in new tabs | |
nnoremap <silent> <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<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> | |
" Vim-Slime should use tmux, and default to window 1 of this pane | |
let g:slime_target = 'tmux' | |
let g:slime_default_config = {'socket_name': 'default', 'target_pane': '.1'} | |
" 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 = "\"" | |
" Customize YankRing | |
let g:yankring_history_file = '.yankring_history' | |
" Customize luainspect | |
let g:lua_inspect_warnings = 0 | |
" Customize CamelCaseMotion | |
map w <Plug>CamelCaseMotion_w | |
map b <Plug>CamelCaseMotion_b | |
map e <Plug>CamelCaseMotion_e | |
sunmap w | |
sunmap b | |
sunmap 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 paredit | |
let g:paredit_smartjump = 1 | |
" Quickly toggle paredit mode | |
nnoremap <silent> <leader>pe :call PareditToggle()<CR> | |
" Customize for Clojure | |
let g:clojure_fuzzy_indent = 1 | |
let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let'] | |
let g:clojure_align_multiline_strings = 1 | |
let g:clojure_fold = 1 | |
" SLIME-like controls for Clojure | |
nnoremap <silent> <leader>f :w<CR>:Require<CR> | |
nnoremap <silent> <leader>F :w<CR>:Require!<CR> | |
function! GotoNamespace() | |
execute "SlimeSend1 (clojure.core/in-ns '".fireplace#ns().")" | |
endfunction | |
nnoremap <silent> <leader>g :call GotoNamespace()<CR> | |
" Remove / from keyword char list for better tag jumping in Clojure | |
autocmd FileType clojure setlocal iskeyword-=/ | |
" Ruby indentation should be 2 | |
autocmd FileType ruby setlocal tabstop=2 | |
" Python, JS, C, and Java use a different indentation standard | |
autocmd Filetype python,javascript,c,java setlocal shiftwidth=4 softtabstop=4 | |
" Python standard is 79 columns and indent can be used for folding | |
autocmd Filetype python setlocal textwidth=79 foldmethod=indent | |
" Spelling for Markdown files | |
autocmd Filetype markdown setlocal spell textwidth=80 | |
" Git commit formatting | |
autocmd Filetype gitcommit setlocal spell textwidth=72 | |
" For NeoVim only: | |
if has('neovim') | |
" Start python support | |
runtime! plugin/python_setup.vim | |
set unnamedclip | |
endif | |
" 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