# HG changeset patch # User Steve Losh # Date 1330456278 18000 # Node ID 82103e5992b37763b68c8e718c2f722ee0bdfcdd # Parent 1c4ccc1b9a951af9071d0ab0604fcb1eec1d7796 Lunchbreak vimrc cleanup. diff -r 1c4ccc1b9a95 -r 82103e5992b3 .hgsubstate --- a/.hgsubstate Mon Feb 27 16:56:57 2012 -0500 +++ b/.hgsubstate Tue Feb 28 14:11:18 2012 -0500 @@ -13,10 +13,10 @@ 34e28b3f6f6d702ff2963b8196eccae9344ed4bc vim/bundle/markdown 2dd198c6c412b4ddd361b43586b01981e8383239 vim/bundle/nerdtree b7889db57c90824ff5092da4fdde9e05689f24fa vim/bundle/nosecompiler -747bb4e33a551b8eb866fd27613d48ea1fd265d1 vim/bundle/powerline +d6da78f985e99d8388cd55db2587b19abc0628c2 vim/bundle/powerline 67033ee4b9ee6d4916752da5e360b65ddf2fb525 vim/bundle/python-mode fa3563dda862c1dc46ddac32d8a9f939e9077379 vim/bundle/rainbow-parentheses -bbcf827907539eaa0fb0c5feac086da2de717399 vim/bundle/slimv +6cbccd24e335319cddd96b152f6d480912375039 vim/bundle/slimv c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup 6eec2c131213850ed65fd6da494dfd1a0d620a4e vim/bundle/strftimedammit ac395b57fec47f034cba151d01669d134ac7041b vim/bundle/supertab diff -r 1c4ccc1b9a95 -r 82103e5992b3 vim/.vimrc --- a/vim/.vimrc Mon Feb 27 16:56:57 2012 -0500 +++ b/vim/.vimrc Tue Feb 28 14:11:18 2012 -0500 @@ -21,7 +21,6 @@ set showcmd set hidden set visualbell -set cursorline set ttyfast set ruler set backspace=indent,eol,start @@ -59,11 +58,22 @@ " Resize splits when the window is resized au VimResized * :wincmd = +" Cursorline {{{ +" Only show cursorline in the current window + +augroup cline + au! + autocmd WinLeave * set nocursorline + autocmd WinEnter * set cursorline +augroup END + +" }}} " cpoptions+=J, dammit {{{ " Something occasionally removes this. If I manage to find it I'm going to " comment out the line and replace all its characters with 'FUCK'. augroup twospace + au! au BufRead * :set cpoptions+=J augroup END @@ -347,20 +357,7 @@ set foldtext=MyFoldText() " }}} -" Destroy infuriating keys ------------------------------------------------ {{{ - -" Fuck you, help key. -noremap :set invfullscreen -inoremap :set invfullscreena - -" Fuck you too, manual key. -nnoremap K - -" Stop it, hash key. -inoremap # X# - -" }}} -" Various filetype-specific stuff ----------------------------------------- {{{ +" Filetype-specific ------------------------------------------------------- {{{ " C {{{ @@ -741,39 +738,23 @@ " }}} " }}} -" Quick editing ----------------------------------------------------------- {{{ +" Convenience mappings ---------------------------------------------------- {{{ -nnoremap ev vj:e $MYVIMRC -nnoremap es vj:e ~/.vim/snippets/ -nnoremap eo vj:e ~/Dropbox/Org4j -nnoremap eh vj:e ~/.hgrc -nnoremap ep vj:e ~/.pentadactylrc -nnoremap em vj:e ~/.mutt/muttrc -nnoremap ez vj:e ~/lib/dotfiles/zsh4j -nnoremap ek vj:e ~/lib/dotfiles/keymando/keymandorc.rb +" Fuck you, help key. +noremap :set invfullscreen +inoremap :set invfullscreena -" }}} -" Shell ------------------------------------------------------------------- {{{ +" Fuck you too, manual key. +nnoremap K -function! s:ExecuteInShell(command) " {{{ - let command = join(map(split(a:command), 'expand(v:val)')) - let winnr = bufwinnr('^' . command . '$') - silent! execute winnr < 0 ? 'botright vnew ' . fnameescape(command) : winnr . 'wincmd w' - setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap nonumber - echo 'Execute ' . command . '...' - silent! execute 'silent %!'. command - silent! redraw - silent! execute 'au BufUnload execute bufwinnr(' . bufnr('#') . ') . ''wincmd w''' - silent! execute 'nnoremap r :call ExecuteInShell(''' . command . '''):AnsiEsc' - silent! execute 'nnoremap q :q' - silent! execute 'AnsiEsc' - echo 'Shell command ' . command . ' executed.' -endfunction " }}} -command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShell() -nnoremap ! :Shell +" Stop it, hash key. +inoremap # X# -" }}} -" Convenience mappings ---------------------------------------------------- {{{ +" For some reason ctags refuses to ignore Python variables, so I'll just hack +" the tags file with sed and strip them out myself. +" +" Sigh. +nnoremap :silent !/usr/local/bin/ctags -R . && sed -i .bak -E -e '/^[^ ]+ [^ ]+.py .+v$/d' tags " Highlight Group nnoremap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' @@ -871,6 +852,26 @@ nnoremap = == vnoremap - = +" Toggle paste +set pastetoggle= + +" Quickreturn +inoremap A +inoremap A: + +" Toggle [i]nvisible characters +nnoremap i :set list! + +" Drag Lines {{{ + +noremap :m+ +noremap :m-2 +inoremap :m+ +inoremap :m-2 +vnoremap :m'>+gv +vnoremap :m-2gv + +" }}} " Easy filetype switching {{{ nnoremap _md :set ft=markdown nnoremap _hd :set ft=htmldjango @@ -879,68 +880,24 @@ nnoremap _pd :set ft=python.django nnoremap _d :set ft=diff " }}} - -" Toggle paste -set pastetoggle= - -" Quickreturn -inoremap A -inoremap A: - -" Toggle [I]nvisible Characters -nnoremap I :set list! - -" Indent Guides {{{ - -let g:indentguides_state = 0 -function! IndentGuides() " {{{ - if g:indentguides_state - let g:indentguides_state = 0 - 2match None - else - let g:indentguides_state = 1 - execute '2match IndentGuides /\%(\_^\s*\)\@<=\%(\%'.(0*&sw+1).'v\|\%'.(1*&sw+1).'v\|\%'.(2*&sw+1).'v\|\%'.(3*&sw+1).'v\|\%'.(4*&sw+1).'v\|\%'.(5*&sw+1).'v\|\%'.(6*&sw+1).'v\|\%'.(7*&sw+1).'v\)\s/' - endif -endfunction " }}} -nnoremap i :call IndentGuides() - -" }}} -" Block Colors {{{ - -let g:blockcolor_state = 0 -function! BlockColor() " {{{ - if g:blockcolor_state - let g:blockcolor_state = 0 - call matchdelete(77880) - call matchdelete(77881) - call matchdelete(77882) - call matchdelete(77883) - else - let g:blockcolor_state = 1 - call matchadd("BlockColor1", '^ \{4}.*', 1, 77880) - call matchadd("BlockColor2", '^ \{8}.*', 2, 77881) - call matchadd("BlockColor3", '^ \{12}.*', 3, 77882) - call matchadd("BlockColor4", '^ \{16}.*', 4, 77883) - endif -endfunction " }}} -nnoremap B :call BlockColor() - -" }}} " Insert Mode Completion {{{ inoremap inoremap " }}} +" Quick editing {{{ + +nnoremap ev vj:e $MYVIMRC +nnoremap es vj:e ~/.vim/snippets/ +nnoremap eo vj:e ~/Dropbox/Org4j +nnoremap eh vj:e ~/.hgrc +nnoremap ep vj:e ~/.pentadactylrc +nnoremap em vj:e ~/.mutt/muttrc +nnoremap ez vj:e ~/lib/dotfiles/zsh4j +nnoremap ek vj:e ~/lib/dotfiles/keymando/keymandorc.rb " }}} -" CTags ------------------------------------------------------------------- {{{ - -" For some reason ctags refuses to ignore Python variables, so I'll just hack -" the tags file with sed and strip them out myself. -" -" Sigh. -nnoremap :silent !/usr/local/bin/ctags -R . && sed -i .bak -E -e '/^[^ ]+ [^ ]+.py .+v$/d' tags " }}} " Plugin settings --------------------------------------------------------- {{{ @@ -1108,8 +1065,9 @@ " Powerline {{{ let g:Powerline_symbols = 'fancy' +let g:Powerline_cache_enabled = 0 " let g:Powerline_theme = 'derp' -" let g:Powerline_colorscheme = 'badwolf' +let g:Powerline_colorscheme = 'badwolf' " }}} " Python-Mode {{{ @@ -1304,40 +1262,40 @@ " }}} " }}} -" Ack motions ------------------------------------------------------------- {{{ +" Mini-plugins ------------------------------------------------------------ {{{ +" Stuff that should probably be broken out into plugins, but hasn't proved to be +" worth the time to do so just yet. -" Motions to Ack for things. Works with pretty much everything, including: -" -" w, W, e, E, b, B, t*, f*, i*, a*, and custom text objects -" -" Awesome. -" -" Note: If the text covered by a motion contains a newline it won't work. Ack -" searches line-by-line. - -nnoremap \a :set opfunc=AckMotiong@ -xnoremap \a :call AckMotion(visualmode()) +" Synstack {{{ -function! s:CopyMotionForType(type) - if a:type ==# 'v' - silent execute "normal! `<" . a:type . "`>y" - elseif a:type ==# 'char' - silent execute "normal! `[v`]y" - endif -endfunction +" Show the stack of syntax hilighting classes affecting whatever is under the +" cursor. +function! SynStack() "{{{ + echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), " > ") +endfunc "}}} -function! s:AckMotion(type) abort - let reg_save = @@ - - call s:CopyMotionForType(a:type) - - execute "normal! :Ack! --literal " . shellescape(@@) . "\" - - let @@ = reg_save -endfunction +nnoremap :call SynStack() " }}} -" Error toggles ----------------------------------------------------------- {{{ +" Diffwhite Toggle {{{ + +set diffopt-=iwhite +let g:diffwhitespaceon = 1 +function! ToggleDiffWhitespace() "{{{ + if g:diffwhitespaceon + set diffopt-=iwhite + let g:diffwhitespaceon = 0 + else + set diffopt+=iwhite + let g:diffwhitespaceon = 1 + endif + diffupdate +endfunc "}}} + +nnoremap dw :call ToggleDiffWhitespace() + +" }}} +" Error Toggles {{{ command! ErrorsToggle call ErrorsToggle() function! ErrorsToggle() " {{{ @@ -1366,143 +1324,38 @@ nmap :QFixToggle " }}} -" Utils ------------------------------------------------------------------- {{{ - -" Synstack {{{ - -" Show the stack of syntax hilighting classes affecting whatever is under the -" cursor. -function! SynStack() "{{{ - echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), " > ") -endfunc "}}} - -nnoremap :call SynStack() - -" }}} -" Toggle whitespace in diffs {{{ +" Fake Paredit {{{ -set diffopt-=iwhite -let g:diffwhitespaceon = 1 -function! ToggleDiffWhitespace() "{{{ - if g:diffwhitespaceon - set diffopt-=iwhite - let g:diffwhitespaceon = 0 - else - set diffopt+=iwhite - let g:diffwhitespaceon = 1 - endif - diffupdate -endfunc "}}} - -nnoremap dw :call ToggleDiffWhitespace() - -" }}} +" TODO: Make this stuff not suck. +nnoremap > xEp +nnoremap < xgEp " }}} -" Hg ---------------------------------------------------------------------- {{{ - -function! s:HgDiff() - diffthis - - let fn = expand('%:p') - let ft = &ft - - wincmd v - edit __hgdiff_orig__ - - setlocal buftype=nofile - - normal ggdG - execute "silent r!hg cat --rev . " . fn - normal ggdd - - execute "setlocal ft=" . ft +" Dtach {{{ - diffthis - diffupdate -endf -command! -nargs=0 HgDiff call s:HgDiff() -nnoremap hd :HgDiff - -function! s:HgBlame() - let fn = expand('%:p') - - wincmd v - wincmd h - edit __hgblame__ - vertical resize 28 +function! SendToDtach(visual) + if a:visual + silent '<,'>w !dtach -s /tmp/target + silent !echo \| dtach -s /tmp/target + else + normal! ^vg_ + silent '<,'>w !dtach -s /tmp/target + execute "normal! " + endif +endfunction - setlocal scrollbind winfixwidth nolist nowrap nonumber buftype=nofile ft=none - - normal ggdG - execute "silent r!hg blame -undq " . fn - normal ggdd - execute ':%s/\v:.*$//' +function! SelectToplevelForm() + " lol + silent! normal vabababababababababababababababababababababababababab +endfunction - wincmd l - setlocal scrollbind - syncbind -endf -command! -nargs=0 HgBlame call s:HgBlame() -nnoremap hb :HgBlame + +nnoremap ee :call SendToDtach(0) +vnoremap ee :call SendToDtach(1) +nnoremap eb mqggvG:call SendToDtach(1)`q " }}} -" Environments (GUI/Console) ---------------------------------------------- {{{ - -if has('gui_running') - set guifont=Menlo\ Regular\ for\ Powerline:h12 - - " Remove all the UI cruft - set go-=T - set go-=l - set go-=L - set go-=r - set go-=R - - highlight SpellBad term=underline gui=undercurl guisp=Orange - - " Use a line-drawing char for pretty vertical splits. - - " Different cursors for different modes. - set guicursor=n-c:block-Cursor-blinkon0 - set guicursor+=v:block-vCursor-blinkon0 - set guicursor+=i-ci:ver20-iCursor - - if has("gui_macvim") - " Full screen means FULL screen - set fuoptions=maxvert,maxhorz - - " Use the normal HIG movements, except for M-Up/Down - let macvim_skip_cmd_opt_movement = 1 - no - no! - no - no! - - no - no! - no - no! - - no - ino - imap { - - no - ino - imap } - - imap - inoremap my0c`y - else - " Non-MacVim GUI, like Gvim - end -else - " Console Vim -endif - -" }}} -" Nyan! ------------------------------------------------------------------- {{{ +" Nyan! {{{ function! NyanMe() " {{{ hi NyanFur guifg=#BBBBBB @@ -1620,34 +1473,207 @@ command! NyanMe call NyanMe() " }}} -" Dtach ------------------------------------------------------------------- {{{ +" Hg {{{ + +function! s:HgDiff() + diffthis + + let fn = expand('%:p') + let ft = &ft + + wincmd v + edit __hgdiff_orig__ + + setlocal buftype=nofile + + normal ggdG + execute "silent r!hg cat --rev . " . fn + normal ggdd + + execute "setlocal ft=" . ft + + diffthis + diffupdate +endf +command! -nargs=0 HgDiff call s:HgDiff() +nnoremap hd :HgDiff + +function! s:HgBlame() + let fn = expand('%:p') + + wincmd v + wincmd h + edit __hgblame__ + vertical resize 28 -function! SendToDtach(visual) - if a:visual - silent '<,'>w !dtach -s /tmp/target - silent !echo \| dtach -s /tmp/target - else - normal! ^vg_ - silent '<,'>w !dtach -s /tmp/target - execute "normal! " + setlocal scrollbind winfixwidth nolist nowrap nonumber buftype=nofile ft=none + + normal ggdG + execute "silent r!hg blame -undq " . fn + normal ggdd + execute ':%s/\v:.*$//' + + wincmd l + setlocal scrollbind + syncbind +endf +command! -nargs=0 HgBlame call s:HgBlame() +nnoremap hb :HgBlame + +" }}} +" Ack motions {{{ + +" Motions to Ack for things. Works with pretty much everything, including: +" +" w, W, e, E, b, B, t*, f*, i*, a*, and custom text objects +" +" Awesome. +" +" Note: If the text covered by a motion contains a newline it won't work. Ack +" searches line-by-line. + +nnoremap \a :set opfunc=AckMotiong@ +xnoremap \a :call AckMotion(visualmode()) + +function! s:CopyMotionForType(type) + if a:type ==# 'v' + silent execute "normal! `<" . a:type . "`>y" + elseif a:type ==# 'char' + silent execute "normal! `[v`]y" endif endfunction -function! SelectToplevelForm() - " lol - silent! normal vabababababababababababababababababababababababababab +function! s:AckMotion(type) abort + let reg_save = @@ + + call s:CopyMotionForType(a:type) + + execute "normal! :Ack! --literal " . shellescape(@@) . "\" + + let @@ = reg_save endfunction +" }}} +" Shell {{{ -nnoremap ee :call SendToDtach(0) -vnoremap ee :call SendToDtach(1) -nnoremap eb mqggvG:call SendToDtach(1)`q +function! s:ExecuteInShell(command) " {{{ + let command = join(map(split(a:command), 'expand(v:val)')) + let winnr = bufwinnr('^' . command . '$') + silent! execute winnr < 0 ? 'botright vnew ' . fnameescape(command) : winnr . 'wincmd w' + setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap nonumber + echo 'Execute ' . command . '...' + silent! execute 'silent %!'. command + silent! redraw + silent! execute 'au BufUnload execute bufwinnr(' . bufnr('#') . ') . ''wincmd w''' + silent! execute 'nnoremap r :call ExecuteInShell(''' . command . '''):AnsiEsc' + silent! execute 'nnoremap q :q' + silent! execute 'AnsiEsc' + echo 'Shell command ' . command . ' executed.' +endfunction " }}} +command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShell() +nnoremap ! :Shell + +" }}} +" Indent Guides {{{ + +let g:indentguides_state = 0 +function! IndentGuides() " {{{ + if g:indentguides_state + let g:indentguides_state = 0 + 2match None + else + let g:indentguides_state = 1 + execute '2match IndentGuides /\%(\_^\s*\)\@<=\%(\%'.(0*&sw+1).'v\|\%'.(1*&sw+1).'v\|\%'.(2*&sw+1).'v\|\%'.(3*&sw+1).'v\|\%'.(4*&sw+1).'v\|\%'.(5*&sw+1).'v\|\%'.(6*&sw+1).'v\|\%'.(7*&sw+1).'v\)\s/' + endif +endfunction " }}} +hi def IndentGuides guibg=#303030 +nnoremap I :call IndentGuides() " }}} -" Fake Paredit ------------------------------------------------------------ {{{ +" Block Colors {{{ -" TODO: Make this stuff not suck. -nnoremap > xEp -nnoremap < xgEp +let g:blockcolor_state = 0 +function! BlockColor() " {{{ + if g:blockcolor_state + let g:blockcolor_state = 0 + call matchdelete(77881) + call matchdelete(77882) + call matchdelete(77883) + call matchdelete(77884) + call matchdelete(77885) + else + let g:blockcolor_state = 1 + call matchadd("BlockColor1", '^ \{4}.*', 1, 77881) + call matchadd("BlockColor2", '^ \{8}.*', 2, 77882) + call matchadd("BlockColor3", '^ \{12}.*', 3, 77883) + call matchadd("BlockColor4", '^ \{16}.*', 4, 77884) + call matchadd("BlockColor5", '^ \{20}.*', 5, 77885) + endif +endfunction " }}} +" Default highlights {{{ +hi def BlockColor1 guibg=#222222 +hi def BlockColor2 guibg=#2a2a2a +hi def BlockColor3 guibg=#353535 +hi def BlockColor4 guibg=#3d3d3d +hi def BlockColor5 guibg=#444444 +" }}} +nnoremap B :call BlockColor() + +" }}} " }}} +" Environments (GUI/Console) ---------------------------------------------- {{{ + +if has('gui_running') + set guifont=Menlo\ Regular\ for\ Powerline:h12 + + " Remove all the UI cruft + set go-=T + set go-=l + set go-=L + set go-=r + set go-=R + + highlight SpellBad term=underline gui=undercurl guisp=Orange + + " Use a line-drawing char for pretty vertical splits. + + " Different cursors for different modes. + set guicursor=n-c:block-Cursor-blinkon0 + set guicursor+=v:block-vCursor-blinkon0 + set guicursor+=i-ci:ver20-iCursor + + if has("gui_macvim") + " Full screen means FULL screen + set fuoptions=maxvert,maxhorz + + " Use the normal HIG movements, except for M-Up/Down + let macvim_skip_cmd_opt_movement = 1 + no + no! + no + no! + + no + no! + no + no! + + no + ino + imap { + + no + ino + imap } + + imap + inoremap my0c`y + else + " Non-MacVim GUI, like Gvim + end +else + " Console Vim +endif + +" }}} diff -r 1c4ccc1b9a95 -r 82103e5992b3 vim/ftplugin/clojure/clojurefolding.vim --- a/vim/ftplugin/clojure/clojurefolding.vim Mon Feb 27 16:56:57 2012 -0500 +++ b/vim/ftplugin/clojure/clojurefolding.vim Tue Feb 28 14:11:18 2012 -0500 @@ -7,6 +7,9 @@ \ 'def', \ 'defn', \ 'defn-', + \ 'defform', + \ 'defform-', + \ 'defrule', \ 'defprotocol', \ 'defparser', \ 'defmacro',