b0cdad7c72af

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 13 Oct 2010 17:56:28 -0400
parents 6b4b61ea3d1d (diff) cdc196e91cd2 (current diff)
children acbc504fc4e7
branches/tags (none)
files vim/bundle/snipmate/snippets/_.snippets vim/bundle/snipmate/snippets/autoit.snippets vim/bundle/snipmate/snippets/c.snippets vim/bundle/snipmate/snippets/cpp.snippets vim/bundle/snipmate/snippets/html.snippets vim/bundle/snipmate/snippets/java.snippets vim/bundle/snipmate/snippets/javascript.snippets vim/bundle/snipmate/snippets/mako.snippets vim/bundle/snipmate/snippets/objc.snippets vim/bundle/snipmate/snippets/perl.snippets vim/bundle/snipmate/snippets/php.snippets vim/bundle/snipmate/snippets/python.snippets vim/bundle/snipmate/snippets/ruby.snippets vim/bundle/snipmate/snippets/sh.snippets vim/bundle/snipmate/snippets/snippet.snippets vim/bundle/snipmate/snippets/tcl.snippets vim/bundle/snipmate/snippets/tex.snippets vim/bundle/snipmate/snippets/vim.snippets vim/bundle/snipmate/snippets/zsh.snippets vim/syntax/htmldjango.vim

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vim/plugin/hexHighlight.vim	Wed Oct 13 17:56:28 2010 -0400
@@ -0,0 +1,42 @@
+"gvim plugin for highlighting hex codes to help with tweaking colors
+"Last Change: 2010 Jan 21
+"Maintainer: Yuri Feldman <feldman.yuri1@gmail.com>
+"License: WTFPL - Do What The Fuck You Want To Public License.
+"Email me if you'd like.
+let s:HexColored = 0
+let s:HexColors = []
+
+map <Leader><F2> :call HexHighlight()<Return>
+function! HexHighlight()
+    if has("gui_running")
+        if s:HexColored == 0
+            let hexGroup = 4
+            let lineNumber = 0
+            while lineNumber <= line("$")
+                let currentLine = getline(lineNumber)
+                let hexLineMatch = 1
+                while match(currentLine, '#\x\{6}', 0, hexLineMatch) != -1
+                    let hexMatch = matchstr(currentLine, '#\x\{6}', 0, hexLineMatch)
+                    exe 'hi hexColor'.hexGroup.' guifg='.hexMatch.' guibg='.hexMatch
+                    exe 'let m = matchadd("hexColor'.hexGroup.'", "'.hexMatch.'", 25, '.hexGroup.')'
+                    let s:HexColors += ['hexColor'.hexGroup]
+                    let hexGroup += 1
+                    let hexLineMatch += 1
+                endwhile
+                let lineNumber += 1
+            endwhile
+            unlet lineNumber hexGroup
+            let s:HexColored = 1
+            echo "Highlighting hex colors..."
+        elseif s:HexColored == 1
+            for hexColor in s:HexColors
+                exe 'highlight clear '.hexColor
+            endfor
+            call clearmatches()
+            let s:HexColored = 0
+            echo "Unhighlighting hex colors..."
+        endif
+    else
+        echo "hexHighlight only works with a graphical version of vim"
+    endif
+endfunction