f8d38666b868

Moar.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 26 Mar 2012 10:21:27 -0400
parents de63c68eb82c
children 16d004f71445
branches/tags (none)
files .hgsubstate bin/sprunge dotjs/unisubs.sifterapp.com.js vim/.vimrc

Changes

--- 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
--- 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
--- 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]();
+        }
+    });
 });
+
--- 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 <c-l>f <c-k>f*
 
 " }}}
+" Convenience mappings ---------------------------------------------------- {{{
+
+" Fuck you, help key.
+noremap  <F1> :set invfullscreen<CR>
+inoremap <F1> <ESC>:set invfullscreen<CR>a
+
+" Stop it, hash key.
+inoremap # X<BS>#
+
+" Kill window
+nnoremap K :q<cr>
+
+" Redraw
+nnoremap <leader>rr :redraw!<cr>
+
+" System clipboard interaction
+" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim
+noremap <leader>y "*y
+noremap <leader>p :set paste<CR>"*p<CR>:set nopaste<CR>
+noremap <leader>P :set paste<CR>"*P<CR>:set nopaste<CR>
+
+" 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 <nop>
+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 <leader><cr> :silent !/usr/local/bin/ctags -R . && sed -i .bak -E -e '/^[^	]+	[^	]+.py	.+v$/d' tags<cr>:redraw!<cr>
+
+" Highlight Group(s)
+nnoremap <F8> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
+\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
+\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
+
+" Clean trailing whitespace
+nnoremap <leader>w mz:%s/\s\+$//<cr>:let @/=''<cr>`z
+
+" Send visual selection to gist.github.com as a private, filetyped Gist
+" Requires the gist command line too (brew install gist)
+" vnoremap <leader>G :w !gist -p -t %:e \| pbcopy<cr>
+" vnoremap <leader>UG :w !gist -p \| pbcopy<cr>
+
+" Send visual selection to sprunge.us
+vnoremap <leader>G :w !curl -sF 'sprunge=<-' 'http://sprunge.us' \| pbcopy<cr>
+
+" Change case
+nnoremap U gUiw
+inoremap <C-u> <esc>gUiwea
+
+" Emacs bindings in command line mode
+cnoremap <c-a> <home>
+cnoremap <c-e> <end>
+
+" Diffoff
+nnoremap <leader>D :diffoff!<cr>
+
+" Formatting, TextMate-style
+nnoremap Q gqip
+vnoremap Q gq
+
+" Easier linewise reselection
+nnoremap <leader>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 i<cr><esc><right>mwgk:silent! s/\v +$//<cr>:noh<cr>`w
+
+" HTML tag closing
+inoremap <C-_> <Space><BS><Esc>:call InsertCloseTag()<cr>a
+
+" Less chording
+nnoremap ; :
+
+" Cmdheight switching
+nnoremap <leader>1 :set cmdheight=1<cr>
+nnoremap <leader>2 :set cmdheight=2<cr>
+
+" Source
+vnoremap <leader>S y:execute @@<cr>:echo 'Sourced selection.'<cr>
+nnoremap <leader>S ^vg_y:execute @@<cr>:echo 'Sourced line.'<cr>
+
+" Marks and Quotes
+noremap ' `
+noremap æ '
+noremap ` <C-^>
+
+" 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<bang>
+command! -bang Q q<bang>
+command! -bang W w<bang>
+command! -bang QA qa<bang>
+command! -bang Qa qa<bang>
+command! -bang Wa wa<bang>
+command! -bang WA wa<bang>
+command! -bang Wq wq<bang>
+command! -bang WQ wq<bang>
+
+" I suck at typing.
+nnoremap <localleader>= ==
+vnoremap - =
+
+" Toggle paste
+set pastetoggle=<F6>
+
+" Toggle [i]nvisible characters
+nnoremap <leader>i :set list!<cr>
+
+" Drag Lines {{{
+
+" <m-j> and <m-k> to drag lines in any mode
+noremap ∆ :m+<CR>
+noremap ˚ :m-2<CR>
+inoremap ∆ <Esc>:m+<CR>
+inoremap ˚ <Esc>:m-2<CR>
+vnoremap ∆ :m'>+<CR>gv
+vnoremap ˚ :m-2<CR>gv
+
+" }}}
+" Easy filetype switching {{{
+
+nnoremap _md :set ft=markdown<CR>
+nnoremap _hd :set ft=htmldjango<CR>
+nnoremap _jt :set ft=htmljinja<CR>
+nnoremap _cw :set ft=confluencewiki<CR>
+nnoremap _pd :set ft=python.django<CR>
+nnoremap _d  :set ft=diff<CR>
+
+" }}}
+" Insert Mode Completion {{{
+
+inoremap <c-l> <c-x><c-l>
+inoremap <c-f> <c-x><c-f>
+inoremap <c-]> <c-x><c-]>
+
+" }}}
+" Quick editing {{{
+
+nnoremap <leader>ev <C-w>v<C-w>j:e $MYVIMRC<cr>
+nnoremap <leader>es <C-w>v<C-w>j:e ~/.vim/snippets/<cr>
+nnoremap <leader>eo <C-w>v<C-w>j:e ~/Dropbox/Org<cr>4j
+nnoremap <leader>eh <C-w>v<C-w>j:e ~/.hgrc<cr>
+nnoremap <leader>ep <C-w>v<C-w>j:e ~/.pentadactylrc<cr>
+nnoremap <leader>em <C-w>v<C-w>j:e ~/.mutt/muttrc<cr>
+nnoremap <leader>ez <C-w>v<C-w>j:e ~/lib/dotfiles/zsh<cr>4j
+nnoremap <leader>ek <C-w>v<C-w>j:e ~/lib/dotfiles/keymando/keymandorc.rb<cr>
+nnoremap <leader>et <C-w>v<C-w>j:e ~/.tmux.conf<cr>
+
+" }}}
+
+" }}}
 " 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  <F1> :set invfullscreen<CR>
-inoremap <F1> <ESC>:set invfullscreen<CR>a
-
-" Stop it, hash key.
-inoremap # X<BS>#
-
-" Kill window
-nnoremap K :q<cr>
-
-" Redraw
-nnoremap <leader>rr :redraw!<cr>
-
-" System clipboard interaction
-" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim
-noremap <leader>y "*y
-noremap <leader>p :set paste<CR>"*p<CR>:set nopaste<CR>
-noremap <leader>P :set paste<CR>"*P<CR>:set nopaste<CR>
-
-" 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 <nop>
-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 <leader><cr> :silent !/usr/local/bin/ctags -R . && sed -i .bak -E -e '/^[^	]+	[^	]+.py	.+v$/d' tags<cr>:redraw!<cr>
-
-" Highlight Group(s)
-nnoremap <F8> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
-\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
-\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
-
-" Clean trailing whitespace
-nnoremap <leader>w :%s/\s\+$//<cr>:let @/=''<cr>
-
-" Send visual selection to gist.github.com as a private, filetyped Gist
-" Requires the gist command line too (brew install gist)
-" vnoremap <leader>G :w !gist -p -t %:e \| pbcopy<cr>
-" vnoremap <leader>UG :w !gist -p \| pbcopy<cr>
-
-" Send visual selection to sprunge.us
-vnoremap <leader>G :w !curl -sF 'sprunge=<-' 'http://sprunge.us' \| pbcopy<cr>
-
-" Change case
-nnoremap U gUiw
-inoremap <C-u> <esc>gUiwea
-
-" Emacs bindings in command line mode
-cnoremap <c-a> <home>
-cnoremap <c-e> <end>
-
-" Diffoff
-nnoremap <leader>D :diffoff!<cr>
-
-" Formatting, TextMate-style
-nnoremap Q gqip
-vnoremap Q gq
-
-" Easier linewise reselection
-nnoremap <leader>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 i<cr><esc><right>mwgk:silent! s/\v +$//<cr>:noh<cr>`w
-
-" HTML tag closing
-inoremap <C-_> <Space><BS><Esc>:call InsertCloseTag()<cr>a
-
-" Less chording
-nnoremap ; :
-
-" Cmdheight switching
-nnoremap <leader>1 :set cmdheight=1<cr>
-nnoremap <leader>2 :set cmdheight=2<cr>
-
-" Source
-vnoremap <leader>S y:execute @@<cr>:echo 'Sourced selection.'<cr>
-nnoremap <leader>S ^vg_y:execute @@<cr>:echo 'Sourced line.'<cr>
-
-" Marks and Quotes
-noremap ' `
-noremap æ '
-noremap ` <C-^>
-
-" 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<bang>
-command! -bang Q q<bang>
-command! -bang W w<bang>
-command! -bang QA qa<bang>
-command! -bang Qa qa<bang>
-command! -bang Wa wa<bang>
-command! -bang WA wa<bang>
-command! -bang Wq wq<bang>
-command! -bang WQ wq<bang>
-
-" I suck at typing.
-nnoremap <localleader>= ==
-vnoremap - =
-
-" Toggle paste
-set pastetoggle=<F6>
-
-" Toggle [i]nvisible characters
-nnoremap <leader>i :set list!<cr>
-
-" Drag Lines {{{
-
-" <m-j> and <m-k> to drag lines in any mode
-noremap ∆ :m+<CR>
-noremap ˚ :m-2<CR>
-inoremap ∆ <Esc>:m+<CR>
-inoremap ˚ <Esc>:m-2<CR>
-vnoremap ∆ :m'>+<CR>gv
-vnoremap ˚ :m-2<CR>gv
-
-" }}}
-" Easy filetype switching {{{
-
-nnoremap _md :set ft=markdown<CR>
-nnoremap _hd :set ft=htmldjango<CR>
-nnoremap _jt :set ft=htmljinja<CR>
-nnoremap _cw :set ft=confluencewiki<CR>
-nnoremap _pd :set ft=python.django<CR>
-nnoremap _d  :set ft=diff<CR>
-
-" }}}
-" Insert Mode Completion {{{
-
-inoremap <c-l> <c-x><c-l>
-inoremap <c-f> <c-x><c-f>
-inoremap <c-]> <c-x><c-]>
-
-" }}}
-" Quick editing {{{
-
-nnoremap <leader>ev <C-w>v<C-w>j:e $MYVIMRC<cr>
-nnoremap <leader>es <C-w>v<C-w>j:e ~/.vim/snippets/<cr>
-nnoremap <leader>eo <C-w>v<C-w>j:e ~/Dropbox/Org<cr>4j
-nnoremap <leader>eh <C-w>v<C-w>j:e ~/.hgrc<cr>
-nnoremap <leader>ep <C-w>v<C-w>j:e ~/.pentadactylrc<cr>
-nnoremap <leader>em <C-w>v<C-w>j:e ~/.mutt/muttrc<cr>
-nnoremap <leader>ez <C-w>v<C-w>j:e ~/lib/dotfiles/zsh<cr>4j
-nnoremap <leader>ek <C-w>v<C-w>j:e ~/lib/dotfiles/keymando/keymandorc.rb<cr>
-nnoremap <leader>et <C-w>v<C-w>j:e ~/.tmux.conf<cr>
-
-" }}}
-
-" }}}
 " 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 :<c-u>call <SID>NumberTextObject(0)<cr>
+xnoremap N :<c-u>call <SID>NumberTextObject(0)<cr>
+onoremap aN :<c-u>call <SID>NumberTextObject(1)<cr>
+xnoremap aN :<c-u>call <SID>NumberTextObject(1)<cr>
+onoremap iN :<c-u>call <SID>NumberTextObject(1)<cr>
+xnoremap iN :<c-u>call <SID>NumberTextObject(1)<cr>
+
+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 ------------------------------------------------------------ {{{