# HG changeset patch # User Steve Losh # Date 1322068333 18000 # Node ID 25d5eafb3add62ab37822b393bfde777b445da70 # Parent 80e85654e5cb7712d9f2903c63ca756d305e8499 Moar. diff -r 80e85654e5cb -r 25d5eafb3add .hgsubstate --- a/.hgsubstate Fri Nov 18 09:37:17 2011 -0500 +++ b/.hgsubstate Wed Nov 23 12:12:13 2011 -0500 @@ -13,7 +13,7 @@ 34e28b3f6f6d702ff2963b8196eccae9344ed4bc vim/bundle/markdown 2dd198c6c412b4ddd361b43586b01981e8383239 vim/bundle/nerdtree b7889db57c90824ff5092da4fdde9e05689f24fa vim/bundle/nosecompiler -5a79d14e3979dd03e979ec3719970a030537d445 vim/bundle/python-mode +67033ee4b9ee6d4916752da5e360b65ddf2fb525 vim/bundle/python-mode fa3563dda862c1dc46ddac32d8a9f939e9077379 vim/bundle/rainbow-parentheses fbc884de41302bb08b93b9d4d9c6921248a31a4c vim/bundle/slimv c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup diff -r 80e85654e5cb -r 25d5eafb3add vim/.vimrc --- a/vim/.vimrc Fri Nov 18 09:37:17 2011 -0500 +++ b/vim/.vimrc Wed Nov 23 12:12:13 2011 -0500 @@ -246,14 +246,14 @@ " Location List QuickFix Window " (e.g. Syntastic) (e.g. Ack) " ---------------------------------- -" Next | M-k M-Down | -" Previous | M-l M-Up | +" Next | M-j M-Down | +" Previous | M-k M-Up | " ---------------------------------- " -nnoremap ˚ :lnextzvzz -nnoremap ¬ :lpreviouszvzz -inoremap ˚ :lnextzvzz -inoremap ¬ :lpreviouszvzz +nnoremap ∆ :lnextzvzz +nnoremap ˚ :lpreviouszvzz +inoremap ∆ :lnextzvzz +inoremap ˚ :lpreviouszvzz nnoremap :cnextzvzz nnoremap :cpreviouszvzz " }}} @@ -876,6 +876,13 @@ " }}} " }}} +" Training mappings ------------------------------------------------------- {{{ + +" Use L, dammit. +nnoremap Ajk +nnoremap A + +" }}} " Plugin settings --------------------------------------------------------- {{{ " Ack {{{ diff -r 80e85654e5cb -r 25d5eafb3add vim/ftplugin/html.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/ftplugin/html.vim Wed Nov 23 12:12:13 2011 -0500 @@ -0,0 +1,82 @@ +" Vim plugin for showing matching html tags. +" Maintainer: Greg Sexton +" Credits: Bram Moolenar and the 'matchparen' plugin from which this draws heavily. + +if exists("b:did_ftplugin") + finish +endif + +augroup matchhtmlparen + autocmd! CursorMoved,CursorMovedI,WinEnter call s:Highlight_Matching_Pair() +augroup END + +fu! s:Highlight_Matching_Pair() + " Remove any previous match. + if exists('w:tag_hl_on') && w:tag_hl_on + 2match none + let w:tag_hl_on = 0 + endif + + " Avoid that we remove the popup menu. + " Return when there are no colors (looks like the cursor jumps). + if pumvisible() || (&t_Co < 8 && !has("gui_running")) + return + endif + + "get html tag under cursor + let tagname = s:GetCurrentCursorTag() + if tagname == ""|return|endif + + if tagname[0] == '/' + let position = s:SearchForMatchingTag(tagname[1:], 0) + else + let position = s:SearchForMatchingTag(tagname, 1) + endif + call s:HighlightTagAtPosition(position) +endfu + +fu! s:GetCurrentCursorTag() + "returns the tag under the cursor, includes the '/' if on a closing tag. + + let c_col = col('.') + let matched = matchstr(getline('.'), '\(<[^<>]*\%'.c_col.'c.\{-}>\)\|\(\%'.c_col.'c<.\{-}>\)') + if matched == "" + return matched + endif + + let tagname = matchstr(matched, '<\zs.\{-}\ze[ >]') + return tagname +endfu + +fu! s:SearchForMatchingTag(tagname, forwards) + "returns the position of a matching tag or [0 0] + + let starttag = '<'.a:tagname.'.\{-}>' + let midtag = '' + let endtag = ''.(a:forwards?'':'\zs') + let flags = 'nW'.(a:forwards?'':'b') + + " When not in a string or comment ignore matches inside them. + let skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . + \ '=~? "htmlString\\|htmlCommentPart"' + execute 'if' skip '| let skip = 0 | endif' + + " Limit the search to lines visible in the window. + let stopline = a:forwards ? line('w$') : line('w0') + let timeout = 300 + + return searchpairpos(starttag, midtag, endtag, flags, skip, stopline, timeout) +endfu + +fu! s:HighlightTagAtPosition(position) + if a:position == [0, 0] + return + endif + + let [m_lnum, m_col] = a:position + exe '2match MatchParen /\(\%' . m_lnum . 'l\%' . m_col . 'c<\zs.\{-}\ze[ >]\)\|' + \ .'\(\%' . line('.') . 'l\%' . col('.') . 'c<\zs.\{-}\ze[ >]\)\|' + \ .'\(\%' . line('.') . 'l<\zs[^<> ]*\%' . col('.') . 'c.\{-}\ze[ >]\)\|' + \ .'\(\%' . line('.') . 'l<\zs[^<>]\{-}\ze\s[^<>]*\%' . col('.') . 'c.\{-}>\)/' + let w:tag_hl_on = 1 +endfu