2e25b11e75fc

A bunch of stuff from the past few days.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 08 Sep 2011 09:20:01 -0400
parents 1e89b58fd3b5
children f09eaa45d84e
branches/tags (none)
files .hgsubstate dotjs/reddit.com.js vim/.vimrc

Changes

--- a/.hgsubstate	Fri Sep 02 17:57:34 2011 -0400
+++ b/.hgsubstate	Thu Sep 08 09:20:01 2011 -0400
@@ -1,5 +1,5 @@
 c711681883f3419b85494e3b285b988e8e2dcbca keymando/Plugins/abbrev
-d6fa160506c3d4f723d1cdb879c57231ce2ab5aa keymando/Plugins/vim
+9d387f6dc90a8e8b1e7085d48ddbe0f8f82a348f keymando/Plugins/vim
 b9bd86b9f476afd164237dce029a46d2607bd931 mercurial/templates
 a41d5d52c39a31128e969e69acf800b198cb07f9 vim/bundle/ack
 bfdf714f8ea10a6bcba7a1375a5700b11077dcd9 vim/bundle/command-t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dotjs/reddit.com.js	Thu Sep 08 09:20:01 2011 -0400
@@ -0,0 +1,1 @@
+$('#url-field div button').remove();
--- a/vim/.vimrc	Fri Sep 02 17:57:34 2011 -0400
+++ b/vim/.vimrc	Thu Sep 08 09:20:01 2011 -0400
@@ -85,12 +85,30 @@
 " }}}
 " Status line {{{
 
-set statusline=%F%m%r%h%w
-set statusline+=\ %#warningmsg#
-set statusline+=%{SyntasticStatuslineFlag()}
-set statusline+=%*
-set statusline+=%=(%{&ff}/%Y)
-set statusline+=\ (line\ %l\/%L,\ col\ %c)
+set statusline=%f    " Path.
+set statusline+=%m   " Modified flag.
+set statusline+=%r   " Readonly flag.
+set statusline+=%w   " Preview window flag.
+
+set statusline+=\    " Space.
+
+set statusline+=%#warningmsg#                " Highlight the following as a warning.
+set statusline+=%{SyntasticStatuslineFlag()} " Syntastic errors.
+set statusline+=%*                           " Reset highlighting.
+
+set statusline+=%=   " Right align.
+
+" File format, encoding and type.  Ex: "(unix/utf-8/python)"
+set statusline+=(
+set statusline+=%{&ff}                        " Format (unix/DOS).
+set statusline+=/
+set statusline+=%{strlen(&fenc)?&fenc:&enc}   " Encoding (utf-8).
+set statusline+=/
+set statusline+=%{&ft}                        " Type (python).
+set statusline+=)
+
+" Line and column position and counts.
+set statusline+=\ (line\ %l\/%L,\ col\ %03c)
 
 " }}}
 " Backups {{{
@@ -138,12 +156,14 @@
 
 set ignorecase
 set smartcase
-
 set incsearch
 set showmatch
 set hlsearch
+set gdefault
 
-set gdefault
+set scrolloff=3
+set sidescroll=1
+set sidescrolloff=10
 
 set virtualedit+=block
 
@@ -152,13 +172,9 @@
 runtime macros/matchit.vim
 map <tab> %
 
+" Made D behave
 nnoremap D d$
 
-" Scrolling
-set scrolloff=3
-set sidescroll=1
-set sidescrolloff=10
-
 " Keep search matches in the middle of the window.
 nnoremap n nzzzv
 nnoremap N Nzzzv
@@ -230,6 +246,18 @@
 nnoremap <silent> <leader>h3 :execute '3match InterestingWord3 /\<<c-r><c-w>\>/'<cr>
 " }}}
 
+" Visual Mode */# from Scrooloose {{{
+function! s:VSetSearch()
+  let temp = @@
+  norm! gvy
+  let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
+  let @@ = temp
+endfunction
+
+vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o>
+vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o>
+" }}}
+
 " }}}
 " Folding --------------------------------------------------------------------- {{{
 
@@ -290,6 +318,8 @@
 au FileType clojure call TurnOnClojureFolding()
 au FileType clojure compiler clojure
 au FileType clojure setlocal report=100000
+au FileType clojure nnoremap <buffer> o A<cr>
+au FileType clojure nnoremap <buffer> O kA<cr>
 
 let g:slimv_leader = '\'
 let g:slimv_keybindings = 2
@@ -303,9 +333,9 @@
 " Use a swank command that works, and doesn't require new app windows.
 au FileType clojure let g:slimv_swank_cmd='!dtach -n /tmp/dvtm-swank.sock -r winch lein swank'
 
-au BufWinEnter Slimv.REPL.clj setlocal winfixwidth
+au BufWinEnter        Slimv.REPL.clj setlocal winfixwidth
 au BufNewFile,BufRead Slimv.REPL.clj setlocal nowrap
-au BufWinEnter Slimv.REPL.clj normal! zR
+au BufWinEnter        Slimv.REPL.clj normal! zR
 
 " }}}
 " Confluence {{{
@@ -385,11 +415,6 @@
 au BufNewFile,BufRead *.fish setlocal filetype=fish
 
 " }}}
-" Help {{{
-
-au BufWinEnter *.txt if &ft == 'help' | wincmd L | endif
-
-" }}}
 " HTML and HTMLDjango {{{
 
 au BufNewFile,BufRead *.html setlocal filetype=htmldjango
@@ -490,6 +515,7 @@
 
 au FileType vim setlocal foldmethod=marker
 au FileType help setlocal textwidth=78
+au BufWinEnter *.txt if &ft == 'help' | wincmd L | endif
 
 " }}}
 
@@ -640,6 +666,7 @@
     endif
 endfunction " }}}
 nnoremap <leader>i :call IndentGuides()<cr>
+
 " }}}
 
 " }}}
@@ -913,20 +940,16 @@
 
 " Show the stack of syntax hilighting classes affecting whatever is under the
 " cursor.
-function! SynStack() " {{{
-  if !exists("*synstack")
-    return
-  endif
+function! SynStack() "{{{
+  echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), " > ")
+endfunc "}}}
 
-  echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
-endfunc " }}}
-
-nmap <M-S> :call SynStack()<CR>
+nnoremap ß :call SynStack()<CR>
 
 " }}}
 
 " }}}
-" Hg Diff --------------------------------------------------------------------- {{{
+" Hg  ------------------------------------------------------------------------- {{{
 
 function! s:HgDiff()
     diffthis
@@ -945,6 +968,34 @@
 command! -nargs=0 HgDiff call s:HgDiff()
 nnoremap <leader>hd :HgDiff<cr>
 
+function! s:HgBlame()
+    let fn = expand('%:p')
+
+    wincmd v
+    wincmd h
+    edit __hgblame__
+    vertical resize 28
+
+    setlocal scrollbind
+    setlocal winfixwidth
+    setlocal nolist
+    setlocal nowrap
+    setlocal nonumber
+    setlocal buftype=nofile
+    setlocal 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 <leader>hb :HgBlame<cr>
+
 " }}}
 " MacVim ---------------------------------------------------------------------- {{{