--- a/vim/.vimrc Mon Dec 27 16:10:25 2010 -0500
+++ b/vim/.vimrc Tue Jan 11 09:24:35 2011 -0500
@@ -42,6 +42,7 @@
" Leader
let mapleader = ","
+let maplocalleader = "\\"
" Make Y not dumb
nnoremap Y y$
@@ -112,7 +113,6 @@
set foldlevelstart=0
nnoremap <Space> za
vnoremap <Space> za
-noremap <leader>ft Vatzf
function! MyFoldText()
let line = getline(v:foldstart)
@@ -134,27 +134,42 @@
" Fuck you, help key.
set fuoptions=maxvert,maxhorz
inoremap <F1> <ESC>:set invfullscreen<CR>a
-nnoremap <F1> :set invfullscreen<CR>
-vnoremap <F1> :set invfullscreen<CR>
+noremap <F1> :set invfullscreen<CR>
" Fuck you too, manual key
nnoremap K <nop>
-" Various syntax stuff
-au BufNewFile,BufRead *.less set filetype=less
-au BufRead,BufNewFile *.scss set filetype=scss
+" Various filetype-specific stuff
+
+au BufNewFile,BufRead *.html setlocal filetype=htmldjango
+au BufNewFile,BufRead *.html setlocal foldmethod=manual
+au BufNewFile,BufRead *.html nnoremap <buffer> <localleader>f Vatzf
-au BufRead,BufNewFile *.confluencewiki set filetype=confluencewiki
-au BufRead,BufNewFile *.confluencewiki set wrap linebreak nolist
+au BufNewFile,BufRead *.less setlocal filetype=less
+au BufNewFile,BufRead *.less setlocal foldmethod=marker
+au BufNewFile,BufRead *.less setlocal foldmarker={,}
+au BufNewFile,BufRead *.less setlocal nocursorline
+
+au BufNewFile,BufRead *.js setlocal foldmethod=marker
+au BufNewFile,BufRead *.js setlocal foldmarker={,}
+
+au BufRead,BufNewFile *.confluencewiki setlocal filetype=confluencewiki
+au BufRead,BufNewFile *.confluencewiki setlocal wrap linebreak nolist
au BufNewFile,BufRead *.m*down set filetype=markdown
-au BufNewFile,BufRead *.m*down nnoremap <leader>1 yypVr=
-au BufNewFile,BufRead *.m*down nnoremap <leader>2 yypVr-
-au BufNewFile,BufRead *.m*down nnoremap <leader>3 I### <ESC>
+au BufNewFile,BufRead *.m*down nnoremap <localleader>1 yypVr=
+au BufNewFile,BufRead *.m*down nnoremap <localleader>2 yypVr-
+au BufNewFile,BufRead *.m*down nnoremap <localleader>3 I### <ESC>
+
+au BufNewFile,BufRead *.vim setlocal foldmethod=marker
-au BufNewFile,BufRead *.vim set foldmethod=marker
+au BufNewFile,BufRead urls.py setlocal nowrap
+au BufNewFile,BufRead settings.py normal! zR
+au BufNewFile,BufRead dashboard.py normal! zR
-au BufNewFile,BufRead urls.py set nowrap
+au BufRead,BufNewFile /etc/nginx/conf/* set ft=nginx
+au BufRead,BufNewFile /etc/nginx/sites-available/* set ft=nginx
+au BufRead,BufNewFile /usr/local/etc/nginx/sites-available/* set ft=nginx
" Sort CSS
map <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR>
@@ -178,23 +193,9 @@
au BufNewFile,BufRead *.js set errorformat=%-P-----\ FILE\ \ :\ \ %f\ -----,Line\ %l\\,\ E:%n:\ %m,%-Q,%-GFound\ %s,%-GSome\ %s,%-Gfixjsstyle%s,%-Gscript\ can\ %s,%-G
" TESTING GOAT APPROVES OF THESE LINES
-au BufNewFile,BufRead test_*.py set makeprg=nosetests\ --machine-out\ --nocapture
-au BufNewFile,BufRead test_*.py set shellpipe=2>&1\ >/dev/null\ \|\ tee
-au BufNewFile,BufRead test_*.py set errorformat=%f:%l:\ %m
-au BufNewFile,BufRead test_*.py nmap <Leader>N :make<cr>
nmap <leader>fn :cn<cr>
nmap <leader>fp :cp<cr>
-" TODO: Put this in filetype-specific files
-au BufNewFile,BufRead *.less set foldmethod=marker
-au BufNewFile,BufRead *.less set foldmarker={,}
-au BufNewFile,BufRead *.less set nocursorline
-au BufRead,BufNewFile /etc/nginx/conf/* set ft=nginx
-au BufRead,BufNewFile /etc/nginx/sites-available/* set ft=nginx
-au BufRead,BufNewFile /usr/local/etc/nginx/sites-available/* set ft=nginx
-au BufNewFile,BufRead *.js set foldmethod=marker
-au BufNewFile,BufRead *.js set foldmarker={,}
-
" Easier linewise reselection
map <leader>v V`]
@@ -216,9 +217,6 @@
nnoremap Vit vitVkoj
nnoremap Vat vatV
-" Diff
-nmap <leader>d :!hg diff %<cr>
-
" Rainbows!
nmap <leader>R :RainbowParenthesesToggle<CR>
@@ -377,6 +375,56 @@
omap <silent> i∑ <Plug>CamelCaseMotion_iw
xmap <silent> i∑ <Plug>CamelCaseMotion_iw
+" Diff
+let g:HgDiffing = 0
+function! s:HgDiffCurrentFile()
+ if g:HgDiffing == 1
+ if bufwinnr(bufnr('__HGDIFF__')) != -1
+ exe bufwinnr(bufnr('__HGDIFF__')) . "wincmd w"
+ bdelete
+ endif
+
+ diffoff!
+
+ let g:HgDiffing = 0
+
+ return
+ endif
+
+ let fname = bufname('%')
+ let ftype = &ft
+ diffthis
+
+ vnew __HGDIFF__
+
+ setlocal buftype=nofile
+ setlocal bufhidden=hide
+ setlocal noswapfile
+ setlocal nobuflisted
+ exec 'setlocal filetype='.ftype
+
+ setlocal modifiable
+
+ silent normal! ggdG
+ silent exec ':r!hg cat ' . fname
+ silent normal! ggdd
+
+ setlocal nomodifiable
+
+ diffthis
+
+ wincmd l
+
+ let g:HgDiffing = 1
+
+ return
+endfunction
+
+command! HgDiffCurrent call s:HgDiffCurrentFile()
+
+nmap <leader>d :HgDiffCurrent<cr>
+
+" MacVim
if has('gui_running')
set guifont=Menlo:h12
@@ -394,6 +442,9 @@
let g:sparkupExecuteMapping = '<D-e>'
highlight SpellBad term=underline gui=undercurl guisp=Orange
+
+ inoremenu <silent>&Plugin.QuickCursor.CloseBuffer <Esc>:w<cr>:BufClose<cr>
+ nnoremenu <silent>&Plugin.QuickCursor.CloseBuffer :w<cr>:BufClose<cr>
else
set nocursorline
endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/plugin/BufClose.vim Tue Jan 11 09:24:35 2011 -0500
@@ -0,0 +1,98 @@
+" BufClose.vim - Close a buffer without closing the window it's in.
+"
+" Copyright February 2003 by Christian J. Robinson <infynity@onewest.net>
+"
+" Distributed under the terms of the Vim license. See ":help license".
+
+" Usage:
+"
+" :BufClose[!] [buffer]
+"
+" Without any arguments the current buffer in the current window is closed.
+" With an argument that buffer is closed if it exists and is currently being
+" displayed in a window.
+"
+" The buffer argument can be a buffer name or number.
+"
+" In both cases if the buffer is modified you have to use ! or an error will
+" be issued and the buffer will be left loaded.
+"
+" Configuration:
+"
+" g:BufClose_AltBuffer
+"
+" Set this variable if you don't want a blank buffer to be loaded in place of
+" the buffer being closed. Examples:
+"
+" :let g:BufClose_AltBuffer = '#'
+"
+" This will cause :BufClose to load the alternate buffer. See ":help :_#".
+"
+" :let g:BufClose_AltBuffer = '.'
+"
+" This will cause :BufClose to load the current directory in the file
+" explorer.
+
+command! -nargs=? -complete=buffer -bang BufClose
+ \ :call BufClose(expand('<args>'), expand('<bang>'))
+
+function! BufClose(buffer, bang)
+ if a:buffer == ''
+ " No buffer provided, use current buffer in the current window.
+ let buffer = bufnr('%')
+ elseif (a:buffer + 0) > 0
+ " A buffer number was provided.
+ let buffer = bufnr(a:buffer + 0)
+ else
+ " A buffer name was provided.
+ let buffer = bufnr(a:buffer)
+ endif
+
+ if buffer == -1
+ echohl ErrorMsg
+ echomsg "No matching buffer for" a:buffer
+ echohl None
+ return
+ endif
+
+ let current_window = winnr()
+ let buffer_window = bufwinnr(buffer)
+
+ if buffer_window == -1
+ echohl ErrorMsg
+ echomsg "Buffer" buffer "isn't open in any windows."
+ echohl None
+ return
+ endif
+
+ if a:bang == '' && getbufvar(buffer, '&modified')
+ echohl ErrorMsg
+ echomsg 'No write since last change for buffer'
+ \ buffer '(add ! to override)'
+ echohl None
+ return
+ endif
+
+ " Move to the proper window if necessary, open a blank buffer,
+ " then move back to the original window...
+ if buffer_window >= 0
+ if current_window == buffer_window
+ if exists('g:BufClose_AltBuffer')
+ exe 'e' . a:bang . ' ' . g:BufClose_AltBuffer
+ else
+ exe 'enew' . a:bang
+ endif
+ else
+ exe 'norm ' . buffer_window . "\<C-w>w"
+ if exists('g:BufClose_AltBuffer')
+ exe 'e' . a:bang . ' ' . g:BufClose_AltBuffer
+ else
+ exe 'enew' . a:bang
+ endif
+ exe 'norm ' . current_window . "\<C-w>w"
+ endif
+ endif
+
+ " ...and delete the specified buffer.
+ silent exe 'bdel' . a:bang . ' ' . buffer
+endfunction