# HG changeset patch # User Steve Losh # Date 1315586004 14400 # Node ID 986fd59e3fae45a407582c6d952645532b216aa9 # Parent 58d7c7bf50673cd82e0ddbf4c0d60b8deaac6445 All the changes from the last few days. diff -r 58d7c7bf5067 -r 986fd59e3fae vim/.vimrc --- a/vim/.vimrc Thu Sep 08 15:30:02 2011 -0400 +++ b/vim/.vimrc Fri Sep 09 12:33:24 2011 -0400 @@ -320,212 +320,297 @@ " C {{{ -au FileType c setlocal foldmethod=syntax +augroup ft_c + au! + au FileType c setlocal foldmethod=syntax +augroup END " }}} " Clojure {{{ -au FileType clojure call TurnOnClojureFolding() -au FileType clojure compiler clojure -au FileType clojure setlocal report=100000 -au FileType clojure nnoremap o A -au FileType clojure nnoremap O kA - let g:slimv_leader = '\' let g:slimv_keybindings = 2 -" Fix the eval mapping. -au FileType clojure nmap \ee \ed +augroup ft_clojure + au! -" Indent top-level form. -au FileType clojure nmap = v((((((((((((=% + au FileType clojure call TurnOnClojureFolding() + au FileType clojure compiler clojure + au FileType clojure setlocal report=100000 + au FileType clojure nnoremap o A + au FileType clojure nnoremap O kA -" 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 BufNewFile,BufRead Slimv.REPL.clj setlocal nowrap + au BufWinEnter Slimv.REPL.clj normal! zR + au BufNewFile,BufRead Slimv.REPL.clj nnoremap A GA -au BufWinEnter Slimv.REPL.clj setlocal winfixwidth -au BufNewFile,BufRead Slimv.REPL.clj setlocal nowrap -au BufWinEnter Slimv.REPL.clj normal! zR + " Fix the eval mapping. + au FileType clojure nmap \ee \ed + + " Indent top-level form. + au FileType clojure nmap = v((((((((((((=% + + " 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' +augroup END " }}} " Confluence {{{ -au BufRead,BufNewFile *.confluencewiki setlocal filetype=confluencewiki +augroup ft_c + au! -" Wiki pages should be soft-wrapped. -au FileType confluencewiki setlocal wrap linebreak nolist + au BufRead,BufNewFile *.confluencewiki setlocal filetype=confluencewiki + + " Wiki pages should be soft-wrapped. + au FileType confluencewiki setlocal wrap linebreak nolist +augroup END " }}} " Cram {{{ -au BufNewFile,BufRead *.t set filetype=cram +let cram_fold=1 + +augroup ft_cram + au! -let cram_fold=1 -autocmd Syntax cram setlocal foldlevel=1 + au BufNewFile,BufRead *.t set filetype=cram + au Syntax cram setlocal foldlevel=1 +augroup END + " }}} " CSS and LessCSS {{{ -au BufNewFile,BufRead *.less setlocal filetype=less +augroup ft_css + au! -au BufNewFile,BufRead *.less,*.css setlocal foldmethod=marker -au BufNewFile,BufRead *.less,*.css setlocal foldmarker={,} + au BufNewFile,BufRead *.less setlocal filetype=less + + au BufNewFile,BufRead *.less,*.css setlocal foldmethod=marker + au BufNewFile,BufRead *.less,*.css setlocal foldmarker={,} -" Use S to sort properties. Turns this: -" -" p { -" width: 200px; -" height: 100px; -" background: red; -" -" ... -" } -" -" into this: + " Use S to sort properties. Turns this: + " + " p { + " width: 200px; + " height: 100px; + " background: red; + " + " ... + " } + " + " into this: -" p { -" background: red; -" height: 100px; -" width: 200px; -" -" ... -" } -au BufNewFile,BufRead *.less,*.css nnoremap S ?{jV/\v^\s*\}?$k:sort:noh + " p { + " background: red; + " height: 100px; + " width: 200px; + " + " ... + " } + au BufNewFile,BufRead *.less,*.css nnoremap S ?{jV/\v^\s*\}?$k:sort:noh -" Make { insert a pair of brackets in such a way that the cursor is correctly -" positioned inside of them AND the following code doesn't get unfolded. -au BufNewFile,BufRead *.less,*.css inoremap { {}.kA + " Make { insert a pair of brackets in such a way that the cursor is correctly + " positioned inside of them AND the following code doesn't get unfolded. + au BufNewFile,BufRead *.less,*.css inoremap { {}.kA +augroup END " }}} " 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 local_settings.py normal! zR +augroup ft_django + au! + + 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 -au BufNewFile,BufRead models.py setlocal filetype=python.django -au BufNewFile,BufRead views.py setlocal filetype=python.django -au BufNewFile,BufRead settings.py setlocal filetype=python.django -au BufNewFile,BufRead settings.py setlocal foldmethod=marker -au BufNewFile,BufRead forms.py setlocal filetype=python.django -au BufNewFile,BufRead common_settings.py setlocal filetype=python.django -au BufNewFile,BufRead common_settings.py setlocal foldmethod=marker + au BufNewFile,BufRead admin.py setlocal filetype=python.django + au BufNewFile,BufRead urls.py setlocal filetype=python.django + au BufNewFile,BufRead models.py setlocal filetype=python.django + au BufNewFile,BufRead views.py setlocal filetype=python.django + au BufNewFile,BufRead settings.py setlocal filetype=python.django + au BufNewFile,BufRead settings.py setlocal foldmethod=marker + au BufNewFile,BufRead forms.py setlocal filetype=python.django + au BufNewFile,BufRead common_settings.py setlocal filetype=python.django + au BufNewFile,BufRead common_settings.py setlocal foldmethod=marker +augroup END " }}} " Firefox {{{ -au BufRead,BufNewFile ~/Library/Caches/*.html setlocal buftype=nofile +augroup ft_firefox + au! + au BufRead,BufNewFile ~/Library/Caches/*.html setlocal buftype=nofile +augroup END " }}} " Fish {{{ -au BufNewFile,BufRead *.fish setlocal filetype=fish +augroup ft_fish + au! + + au BufNewFile,BufRead *.fish setlocal filetype=fish +augroup END " }}} " HTML and HTMLDjango {{{ -au BufNewFile,BufRead *.html setlocal filetype=htmldjango -au FileType html,jinja,htmldjango setlocal foldmethod=manual +augroup ft_html + au! -" Use f to fold the current tag. -au FileType html,jinja,htmldjango nnoremap f Vatzf + au BufNewFile,BufRead *.html setlocal filetype=htmldjango + au FileType html,jinja,htmldjango setlocal foldmethod=manual + + " Use f to fold the current tag. + au FileType html,jinja,htmldjango nnoremap f Vatzf -" Use Shift-Return to turn this: -" | -" -" into this: -" -" | -" -au FileType html,jinja,htmldjango nnoremap vitavitoi + " Use Shift-Return to turn this: + " | + " + " into this: + " + " | + " + au FileType html,jinja,htmldjango nnoremap vitavitoi -" Smarter pasting -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' + " Smarter pasting + 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 {%%} + " Django tags + au FileType jinja,htmldjango inoremap {%%} -" Django variables -au FileType jinja,htmldjango inoremap {{}} + " Django variables + au FileType jinja,htmldjango inoremap {{}} +augroup END " }}} " Javascript {{{ -au FileType javascript setlocal foldmethod=marker -au FileType javascript setlocal foldmarker={,} +augroup ft_javascript + au! + + au FileType javascript setlocal foldmethod=marker + au FileType javascript setlocal foldmarker={,} +augroup END " }}} " Lisp {{{ -au FileType lisp call TurnOnLispFolding() +augroup ft_lisp + au! + au FileType lisp call TurnOnLispFolding() +augroup END " }}} " Markdown {{{ -au BufNewFile,BufRead *.m*down setlocal filetype=markdown +augroup ft_markdown + au! + + au BufNewFile,BufRead *.m*down setlocal filetype=markdown -" Use 1/2/3 to add headings. -au Filetype markdown nnoremap 1 yypVr= -au Filetype markdown nnoremap 2 yypVr- -au Filetype markdown nnoremap 3 I### + " Use 1/2/3 to add headings. + au Filetype markdown nnoremap 1 yypVr= + au Filetype markdown nnoremap 2 yypVr- + au Filetype markdown nnoremap 3 I### +augroup END " }}} " Nginx {{{ -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 BufRead,BufNewFile vhost.nginx set ft=nginx +augroup ft_nginx + au! + + 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 BufRead,BufNewFile vhost.nginx set ft=nginx +augroup END " }}} " Pentadactyl {{{ -au BufNewFile,BufRead .pentadactylrc set filetype=pentadactyl +augroup ft_pentadactyl + au! + au BufNewFile,BufRead .pentadactylrc set filetype=pentadactyl +augroup END " }}} " Puppet {{{ -au Filetype puppet setlocal foldmethod=marker -au Filetype puppet setlocal foldmarker={,} +augroup ft_puppet + au! + + au Filetype puppet setlocal foldmethod=marker + au Filetype puppet setlocal foldmarker={,} +augroup END " }}} " Python {{{ -au Filetype python noremap rr :RopeRename -au Filetype python vnoremap rm :RopeExtractMethod -au Filetype python noremap ri :RopeOrganizeImports -au FileType python setlocal omnifunc=pythoncomplete#Complete +augroup ft_python + au! + + au Filetype python noremap rr :RopeRename + au Filetype python vnoremap rm :RopeExtractMethod + au Filetype python noremap ri :RopeOrganizeImports + + au FileType python setlocal omnifunc=pythoncomplete#Complete +augroup END + +" }}} +" QuickFix {{{ + +augroup ft_quickfix + au! + au Filetype qf setlocal colorcolumn=0 nolist nocursorline nowrap +augroup END " }}} " ReStructuredText {{{ -au Filetype rst nnoremap 1 yypVr= -au Filetype rst nnoremap 2 yypVr- -au Filetype rst nnoremap 3 yypVr~ -au Filetype rst nnoremap 4 yypVr` +augroup ft_rest + au! + + au Filetype rst nnoremap 1 yypVr= + au Filetype rst nnoremap 2 yypVr- + au Filetype rst nnoremap 3 yypVr~ + au Filetype rst nnoremap 4 yypVr` +augroup END " }}} " Ruby {{{ -au Filetype ruby setlocal foldmethod=syntax +augroup ft_ruby + au! + au Filetype ruby setlocal foldmethod=syntax +augroup END " }}} " Vagrant {{{ -au BufRead,BufNewFile Vagrantfile set ft=ruby +augroup ft_vagrant + au! + au BufRead,BufNewFile Vagrantfile set ft=ruby +augroup END " }}} " Vim {{{ -au FileType vim setlocal foldmethod=marker -au FileType help setlocal textwidth=78 -au BufWinEnter *.txt if &ft == 'help' | wincmd L | endif +augroup ft_vim + au! + + au FileType vim setlocal foldmethod=marker + au FileType help setlocal textwidth=78 + au BufWinEnter *.txt if &ft == 'help' | wincmd L | endif +augroup END " }}} @@ -1019,10 +1104,33 @@ set go-=r set go-=R - " PeepOpen on OS X, Command-T elsewhere. if has("gui_macvim") + " PeepOpen on OS X, Command-T elsewhere. macmenu &File.New\ Tab key= map PeepOpen + + " Use the normal HIG movements, except for M-Up/Down + let macvim_skip_cmd_opt_movement = 1 + no + no! + no + no! + + no + no! + no + no! + + no + ino + imap { + + no + ino + imap } + + imap + inoremap my0c`y else map :CommandT end @@ -1036,29 +1144,6 @@ set guicursor=n-c:block-Cursor-blinkon0 set guicursor+=v:block-vCursor-blinkon0 set guicursor+=i-ci:ver20-iCursor - - " Use the normal HIG movements, except for M-Up/Down - let macvim_skip_cmd_opt_movement = 1 - no - no! - no - no! - - no - no! - no - no! - - no - ino - imap { - - no - ino - imap } - - imap - inoremap my0c`y else " Command-T if we don't have a GUI. map :CommandT diff -r 58d7c7bf5067 -r 986fd59e3fae vim/snippets/django.snippets --- a/vim/snippets/django.snippets Thu Sep 08 15:30:02 2011 -0400 +++ b/vim/snippets/django.snippets Fri Sep 09 12:33:24 2011 -0400 @@ -123,3 +123,6 @@ @render_to('${1}') def ${2:view_name}(request${3:, ...}):${4} return {} +snippet defu + def __unicode__(self): + return u'${1}' % (${2})