Skip to content
Browse files

Fixing nasty StrLen error

  • Loading branch information...
1 parent 809ca82 commit 5c9b1f1ca2093f1d54a495b53000cf78d43339ca @skammer committed Oct 13, 2010
Showing with 11 additions and 7 deletions.
  1. +1 −1 README.md
  2. +10 −6 after/syntax/css.vim
View
2 README.md
@@ -10,6 +10,6 @@ So here is my patch.
![Screen shot](http://github.com/skammer/vim-css-color/raw/master/Screen%20shot%202010-07-04%20at%200.19.46.png)
-[My inpiration](http://julien.danjou.info/rainbow-mode.html) and [ConvertBase.vim](http://www.vim.org/scripts/script.php?script_id=54) plugin I used for base conversion.
+Major kudos to [rainbow-mode.el](http://julien.danjou.info/rainbow-mode.html), from which I borrowed some code, and to [ConvertBase.vim](http://www.vim.org/scripts/script.php?script_id=54) plugin I used for base conversion.
I highly recomend using [pathogen.vim](http://www.vim.org/scripts/script.php?script_id=2332) plugin for all your plugin installations. It's so good, it should be illegal. God bless Tim Pope.
View
16 after/syntax/css.vim
@@ -1,9 +1,13 @@
-" Language: Colored CSS Color Preview
-" Author: Niklas Hofer <niklas+vim@lanpartei.de>
-" Maintainer: Max Vasiliev <vim@skammer.name>
+" Language: Colored CSS Color Preview
+" Author: Niklas Hofer <niklas+vim@lanpartei.de>
+" Maintainer: Max Vasiliev <vim@skammer.name>
" Last Change: 2010 Jul 3
-" Licence: No Warranties. WTFPL. But please tell me!
-" Version: 0.7
+" Licence: No Warranties. WTFPL. But please tell me!
+" Version: 0.7
+
+function! s:StrLen(str)
+ return strlen(substitute(a:str, '.', 'x', 'g'))
+endfunction
function! s:FGforBG(bg)
" takes a 6hex color code and returns a matching color that is visible
@@ -157,7 +161,7 @@ endfunction
" This piece of code was ported from lisp.
" http://julien.danjou.info/rainbow-mode.html
fun! s:RGBRelativeToAbsolute(value)
- let string_length = StrLen(a:value)-1
+ let string_length = s:StrLen(a:value)-1
if strpart(a:value, string_length, 1) == '%'
let hex_value = s:ConvertToBase( 255*strpart(a:value, 0, string_length)/100, 16 )
if len(hex_value) == 1

0 comments on commit 5c9b1f1

Please sign in to comment.
Something went wrong with that request. Please try again.