# HG changeset patch # User Steve Losh # Date 1332771687 14400 # Node ID f8d38666b86861d8e5d01c7e3574f5692b254388 # Parent de63c68eb82c496c81e23e5da54876a8e0a4517d Moar. diff -r de63c68eb82c -r f8d38666b868 .hgsubstate --- a/.hgsubstate Wed Mar 21 11:03:55 2012 -0400 +++ b/.hgsubstate Mon Mar 26 10:21:27 2012 -0400 @@ -16,7 +16,7 @@ d6da78f985e99d8388cd55db2587b19abc0628c2 vim/bundle/powerline d27022dc0bf2302cf31015d1ca0a2f80d55f3596 vim/bundle/python-mode fa3563dda862c1dc46ddac32d8a9f939e9077379 vim/bundle/rainbow-parentheses -f4c1752e7421ffbcb37a65a6e925a4b96d0d696f vim/bundle/slimv +86228e5aaf622c6386ab4e98c3bca144ca333ba1 vim/bundle/slimv c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup 6eec2c131213850ed65fd6da494dfd1a0d620a4e vim/bundle/strftimedammit b8a34a485dfdda1f88a2290c8e4b611556cc2fc4 vim/bundle/supertab diff -r de63c68eb82c -r f8d38666b868 bin/sprunge --- a/bin/sprunge Wed Mar 21 11:03:55 2012 -0400 +++ b/bin/sprunge Mon Mar 26 10:21:27 2012 -0400 @@ -1,3 +1,3 @@ #!/usr/bin/env bash -curl -F 'sprunge=<-' http://sprunge.us | pbcopy +curl -F 'sprunge=<-' http://sprunge.us | tr -d '\n' | pbcopy diff -r de63c68eb82c -r f8d38666b868 dotjs/unisubs.sifterapp.com.js --- a/dotjs/unisubs.sifterapp.com.js Wed Mar 21 11:03:55 2012 -0400 +++ b/dotjs/unisubs.sifterapp.com.js Mon Mar 26 10:21:27 2012 -0400 @@ -5,4 +5,26 @@ ); $(el).remove(); }); + + $('body').keydown(function(e) { + + $tickets = $('tr.issue td.subject a'); + + cmds = { + '49': function() { + document.location = $tickets.eq(0).attr('href'); + }, + '50': function() { + document.location = $tickets.eq(1).attr('href'); + }, + '51': function() { + document.location = $tickets.eq(2).attr('href'); + } + }; + + if (typeof cmds[e.keyCode] === 'function') { + cmds[e.keyCode](); + } + }); }); + diff -r de63c68eb82c -r f8d38666b868 vim/.vimrc --- a/vim/.vimrc Wed Mar 21 11:03:55 2012 -0400 +++ b/vim/.vimrc Mon Mar 26 10:21:27 2012 -0400 @@ -74,6 +74,16 @@ augroup END " }}} +" Colorcolumn {{{ +" Only show colorcolumn in the current window. + +augroup ccol + au! + au WinLeave * setlocal colorcolumn=0 + au WinEnter * setlocal colorcolumn=+1 +augroup END + +" }}} " cpoptions+=J, dammit {{{ " Something occasionally removes this. If I manage to find it I'm going to @@ -209,6 +219,172 @@ inoremap f f* " }}} +" Convenience mappings ---------------------------------------------------- {{{ + +" Fuck you, help key. +noremap :set invfullscreen +inoremap :set invfullscreena + +" Stop it, hash key. +inoremap # X# + +" Kill window +nnoremap K :q + +" Redraw +nnoremap rr :redraw! + +" System clipboard interaction +" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim +noremap y "*y +noremap p :set paste"*p:set nopaste +noremap P :set paste"*P:set nopaste + +" I constantly hit "u" in visual mode when I mean to "y". Use "gu" for those rare occasions. +" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim +vnoremap u +vnoremap gu u + +" 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:redraw! + +" Highlight Group(s) +nnoremap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' +\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" +\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + +" Clean trailing whitespace +nnoremap w mz:%s/\s\+$//:let @/=''`z + +" Send visual selection to gist.github.com as a private, filetyped Gist +" Requires the gist command line too (brew install gist) +" vnoremap G :w !gist -p -t %:e \| pbcopy +" vnoremap UG :w !gist -p \| pbcopy + +" Send visual selection to sprunge.us +vnoremap G :w !curl -sF 'sprunge=<-' 'http://sprunge.us' \| pbcopy + +" Change case +nnoremap U gUiw +inoremap gUiwea + +" Emacs bindings in command line mode +cnoremap +cnoremap + +" Diffoff +nnoremap D :diffoff! + +" Formatting, TextMate-style +nnoremap Q gqip +vnoremap Q gq + +" Easier linewise reselection +nnoremap V V`] + +" Keep the cursor in place while joining limes +nnoremap J mzJ`z + +" Split line (sister to [J]oin lines) +" The normal use of S is covered by cc, so don't worry about shadowing it. +nnoremap S imwgk:silent! s/\v +$//:noh`w + +" HTML tag closing +inoremap :call InsertCloseTag()a + +" Less chording +nnoremap ; : + +" Cmdheight switching +nnoremap 1 :set cmdheight=1 +nnoremap 2 :set cmdheight=2 + +" Source +vnoremap S y:execute @@:echo 'Sourced selection.' +nnoremap S ^vg_y:execute @@:echo 'Sourced line.' + +" Marks and Quotes +noremap ' ` +noremap æ ' +noremap ` + +" Select (charwise) the contents of the current line, excluding indentation. +" Great for pasting Python lines into REPLs. +nnoremap vv ^vg_ + +" Better Completion +set completeopt=longest,menuone,preview + +" Sudo to write +cnoremap w!! w !sudo tee % >/dev/null + +" Typos +command! -bang E e +command! -bang Q q +command! -bang W w +command! -bang QA qa +command! -bang Qa qa +command! -bang Wa wa +command! -bang WA wa +command! -bang Wq wq +command! -bang WQ wq + +" I suck at typing. +nnoremap = == +vnoremap - = + +" Toggle paste +set pastetoggle= + +" Toggle [i]nvisible characters +nnoremap i :set list! + +" Drag Lines {{{ + +" and to drag lines in any mode +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 +nnoremap _jt :set ft=htmljinja +nnoremap _cw :set ft=confluencewiki +nnoremap _pd :set ft=python.django +nnoremap _d :set ft=diff + +" }}} +" Insert Mode Completion {{{ + +inoremap +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 +nnoremap et vj:e ~/.tmux.conf + +" }}} + +" }}} " Searching and movement -------------------------------------------------- {{{ " Use sane regexes. @@ -654,7 +830,7 @@ augroup ft_quickfix au! - au Filetype qf setlocal colorcolumn=0 nolist nocursorline nowrap + au Filetype qf setlocal colorcolumn=0 nolist nocursorline nowrap tw=0 augroup END " }}} @@ -699,172 +875,6 @@ " }}} " }}} -" Convenience mappings ---------------------------------------------------- {{{ - -" Fuck you, help key. -noremap :set invfullscreen -inoremap :set invfullscreena - -" Stop it, hash key. -inoremap # X# - -" Kill window -nnoremap K :q - -" Redraw -nnoremap rr :redraw! - -" System clipboard interaction -" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim -noremap y "*y -noremap p :set paste"*p:set nopaste -noremap P :set paste"*P:set nopaste - -" I constantly hit "u" in visual mode when I mean to "y". Use "gu" for those rare occasions. -" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim -vnoremap u -vnoremap gu u - -" 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:redraw! - -" Highlight Group(s) -nnoremap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' -\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" -\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" - -" Clean trailing whitespace -nnoremap w :%s/\s\+$//:let @/='' - -" Send visual selection to gist.github.com as a private, filetyped Gist -" Requires the gist command line too (brew install gist) -" vnoremap G :w !gist -p -t %:e \| pbcopy -" vnoremap UG :w !gist -p \| pbcopy - -" Send visual selection to sprunge.us -vnoremap G :w !curl -sF 'sprunge=<-' 'http://sprunge.us' \| pbcopy - -" Change case -nnoremap U gUiw -inoremap gUiwea - -" Emacs bindings in command line mode -cnoremap -cnoremap - -" Diffoff -nnoremap D :diffoff! - -" Formatting, TextMate-style -nnoremap Q gqip -vnoremap Q gq - -" Easier linewise reselection -nnoremap V V`] - -" Keep the cursor in place while joining limes -nnoremap J mzJ`z - -" Split line (sister to [J]oin lines) -" The normal use of S is covered by cc, so don't worry about shadowing it. -nnoremap S imwgk:silent! s/\v +$//:noh`w - -" HTML tag closing -inoremap :call InsertCloseTag()a - -" Less chording -nnoremap ; : - -" Cmdheight switching -nnoremap 1 :set cmdheight=1 -nnoremap 2 :set cmdheight=2 - -" Source -vnoremap S y:execute @@:echo 'Sourced selection.' -nnoremap S ^vg_y:execute @@:echo 'Sourced line.' - -" Marks and Quotes -noremap ' ` -noremap æ ' -noremap ` - -" Select (charwise) the contents of the current line, excluding indentation. -" Great for pasting Python lines into REPLs. -nnoremap vv ^vg_ - -" Better Completion -set completeopt=longest,menuone,preview - -" Sudo to write -cnoremap w!! w !sudo tee % >/dev/null - -" Typos -command! -bang E e -command! -bang Q q -command! -bang W w -command! -bang QA qa -command! -bang Qa qa -command! -bang Wa wa -command! -bang WA wa -command! -bang Wq wq -command! -bang WQ wq - -" I suck at typing. -nnoremap = == -vnoremap - = - -" Toggle paste -set pastetoggle= - -" Toggle [i]nvisible characters -nnoremap i :set list! - -" Drag Lines {{{ - -" and to drag lines in any mode -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 -nnoremap _jt :set ft=htmljinja -nnoremap _cw :set ft=confluencewiki -nnoremap _pd :set ft=python.django -nnoremap _d :set ft=diff - -" }}} -" Insert Mode Completion {{{ - -inoremap -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 -nnoremap et vj:e ~/.tmux.conf - -" }}} - -" }}} " Plugin settings --------------------------------------------------------- {{{ " Ack {{{ @@ -1253,6 +1263,38 @@ endfunction " }}} +" Numbers {{{ + +" Motion for numbers. Great for CSS. Lets you do things like this: +" +" margin-top: 200px; -> daN -> margin-top: px; +" ^ ^ +" TODO: Handle floats. + +onoremap N :call NumberTextObject(0) +xnoremap N :call NumberTextObject(0) +onoremap aN :call NumberTextObject(1) +xnoremap aN :call NumberTextObject(1) +onoremap iN :call NumberTextObject(1) +xnoremap iN :call NumberTextObject(1) + +function! s:NumberTextObject(whole) + normal! v + + while getline('.')[col('.')] =~# '\v[0-9]' + normal! l + endwhile + + if a:whole + normal! o + + while col('.') > 1 && getline('.')[col('.') - 2] =~# '\v[0-9]' + normal! h + endwhile + endif +endfunction + +" }}} " }}} " Mini-plugins ------------------------------------------------------------ {{{