# HG changeset patch # User Steve Losh # Date 1314302939 14400 # Node ID 499618b0bd28fe5a748a0c2760170cbf9b9256bd # Parent 0f4f4d6f9b4e523e33437ae102e11b832020436a Lots. diff -r 0f4f4d6f9b4e -r 499618b0bd28 .zshrc --- a/.zshrc Tue Aug 23 12:34:48 2011 -0400 +++ b/.zshrc Thu Aug 25 16:08:59 2011 -0400 @@ -18,6 +18,7 @@ alias oldgcc='export CC=/usr/bin/gcc-4.0' alias tm='tmux -u2' alias c='clear' +alias bp='bpython' # Environment variables ------------------------------------------------------ export EDITOR='vim' diff -r 0f4f4d6f9b4e -r 499618b0bd28 vim/.vimrc --- a/vim/.vimrc Tue Aug 23 12:34:48 2011 -0400 +++ b/vim/.vimrc Thu Aug 25 16:08:59 2011 -0400 @@ -218,6 +218,9 @@ " cursor happens to be. nnoremap zO zCzO +" Use ,z to "focus" the current fold. +nnoremap z zMzv + function! MyFoldText() " {{{ let line = getline(v:foldstart) @@ -341,9 +344,10 @@ " }}} " Django {{{ -au BufNewFile,BufRead urls.py setlocal nowrap -au BufNewFile,BufRead urls.py normal! zR -au BufNewFile,BufRead dashboard.py normal! zR +au BufNewFile,BufRead urls.py setlocal nowrap +au BufNewFile,BufRead urls.py normal! zR +au BufNewFile,BufRead dashboard.py normal! zR +au BufNewFile,BufRead local_settings.py normal! zR au BufNewFile,BufRead admin.py setlocal filetype=python.django au BufNewFile,BufRead urls.py setlocal filetype=python.django @@ -368,7 +372,7 @@ " }}} " Help {{{ -au FileType help wincmd L +au BufWinEnter *.txt if &ft == 'help' | wincmd L | endif " }}} " HTML and HTMLDjango {{{ @@ -388,6 +392,13 @@ " au FileType html,jinja,htmldjango nnoremap vitavitoi +" Smarter pasting +au FileType html,jinja,htmldjango nnoremap Y :YRYankCount 'y$' +au FileType html,jinja,htmldjango nnoremap p :YRPaste 'p'v`]=`] +au FileType html,jinja,htmldjango nnoremap P :YRPaste 'P'v`]=`] +au FileType html,jinja,htmldjango nnoremap π :YRPaste 'p' +au FileType html,jinja,htmldjango nnoremap ∏ :YRPaste 'P' + " Django tags au FileType jinja,htmldjango inoremap {%%} @@ -517,15 +528,6 @@ nnoremap 1 :set cmdheight=1 nnoremap 2 :set cmdheight=2 -" Paste intelligently by default, use option+p to paste raw. -function! YRRunAfterMaps() - nnoremap Y :YRYankCount 'y$' - nnoremap p :YRPaste 'p'v`]=`] - nnoremap P :YRPaste 'P'v`]=`] - nnoremap π :YRPaste 'p' - nnoremap ∏ :YRPaste 'P' -endfunction - " Replaste nnoremap "_ddPV`]= @@ -552,6 +554,9 @@ " Tags nnoremap T :!ctags -R -f ./tags . +" I suck at typing. +nnoremap = == + " Easy filetype switching nnoremap _md :set ft=markdown nnoremap _hd :set ft=htmldjango @@ -778,95 +783,35 @@ vnoremap ad a[ " }}} -" Next/Last () {{{ -vnoremap inb :normal! f(vib -onoremap inb :normal! f(vib -vnoremap anb :normal! f(vab -onoremap anb :normal! f(vab -vnoremap in( :normal! f(vi( -onoremap in( :normal! f(vi( -vnoremap an( :normal! f(va( -onoremap an( :normal! f(va( +" Next and Last {{{ + +" Motion for "next/last object". For example, "din(" would go to the next "()" pair +" and delete its contents. -vnoremap ilb :normal! F)vib -onoremap ilb :normal! F)vib -vnoremap alb :normal! F)vab -onoremap alb :normal! F)vab -vnoremap il( :normal! F)vi( -onoremap il( :normal! F)vi( -vnoremap al( :normal! F)va( -onoremap al( :normal! F)va( -" }}} -" Next/Last {} {{{ -vnoremap inB :normal! f{viB -onoremap inB :normal! f{viB -vnoremap anB :normal! f{vaB -onoremap anB :normal! f{vaB -vnoremap in{ :normal! f{vi{ -onoremap in{ :normal! f{vi{ -vnoremap an{ :normal! f{va{ -onoremap an{ :normal! f{va{ +onoremap an :call NextTextObject('a', 'f') +xnoremap an :call NextTextObject('a', 'f') +onoremap in :call NextTextObject('i', 'f') +xnoremap in :call NextTextObject('i', 'f') + +onoremap al :call NextTextObject('a', 'F') +xnoremap al :call NextTextObject('a', 'F') +onoremap il :call NextTextObject('i', 'F') +xnoremap il :call NextTextObject('i', 'F') -vnoremap ilB :normal! F}viB -onoremap ilB :normal! F}viB -vnoremap alB :normal! F}vaB -onoremap alB :normal! F}vaB -vnoremap il{ :normal! F}vi{ -onoremap il{ :normal! F}vi{ -vnoremap al{ :normal! F}va{ -onoremap al{ :normal! F}va{ -" }}} -" Next/Last [] {{{ -vnoremap ind :normal! f[vi[ -onoremap ind :normal! f[vi[ -vnoremap and :normal! f[va[ -onoremap and :normal! f[va[ -vnoremap in[ :normal! f[vi[ -onoremap in[ :normal! f[vi[ -vnoremap an[ :normal! f[va[ -onoremap an[ :normal! f[va[ +function! s:NextTextObject(motion, dir) + let c = nr2char(getchar()) -vnoremap ild :normal! F]vi[ -onoremap ild :normal! F]vi[ -vnoremap ald :normal! F]va[ -onoremap ald :normal! F]va[ -vnoremap il[ :normal! F]vi[ -onoremap il[ :normal! F]vi[ -vnoremap al[ :normal! F]va[ -onoremap al[ :normal! F]va[ -" }}} -" Next/Last <> {{{ -vnoremap in< :normal! f -onoremap in< :normal! f -vnoremap an< :normal! f -onoremap an< :normal! f + if c ==# "b" + let c = "(" + elseif c ==# "B" + let c = "{" + elseif c ==# "d" + let c = "[" + endif -vnoremap il< :normal! f>vi< -onoremap il< :normal! f>vi< -vnoremap al< :normal! f>va< -onoremap al< :normal! f>va< -" }}} -" Next '' {{{ -vnoremap in' :normal! f'vi' -onoremap in' :normal! f'vi' -vnoremap an' :normal! f'va' -onoremap an' :normal! f'va' + exe "normal! ".a:dir.c."v".a:motion.c +endfunction -vnoremap il' :normal! F'vi' -onoremap il' :normal! F'vi' -vnoremap al' :normal! F'va' -onoremap al' :normal! F'va' -" }}} -" Next "" {{{ -vnoremap in" :normal! f"vi" -onoremap in" :normal! f"vi" -vnoremap an" :normal! f"va" -onoremap an" :normal! f"va" - -vnoremap il" :normal! F"vi" -onoremap il" :normal! F"vi" -vnoremap al" :normal! F"va" -onoremap al" :normal! F"va" " }}} " }}}