Skip to content

Commit

Permalink
Use setlocal over set to contain changes to buffer
Browse files Browse the repository at this point in the history
Using `set isk` changes rules about what characters count as keywords in
buffers that don't contain CSS. Plugins should use `setlocal` for to
change settings for a buffer.

Updated the command invocation to use `iskeyword` to improve
clarity about what the function is doing.

Fix #20.
Fix #22.
Fix #26.
  • Loading branch information
geoffharcourt committed Feb 5, 2016
1 parent 0c21b14 commit 304ced6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions after/syntax/css/vim-coloresque.vim
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ function! s:RestoreColors()
"if b:color_pattern[part]=="ffffff"
"echoe part
"endif

call s:MatchColorValue(b:color_pattern[part], part)
"echoe color
"echoe b:color_pattern[color]
"let group = 'cssColor' . tolower(strpart(b:color_pattern[part]["color"], 1))
""exe 'syn match' group '/'.escape(pattern, '/').'/ contained'
"exe 'syn cluster cssColors add='.group
"exe 'hi' group s:color_prefix.'bg='.b:color_pattern[part]["bg"] s:color_prefix.'fg='.b:color_pattern[part]["fg"]

"if !exists('b:matchescache')
"let b:matchescache={}
"endif
Expand Down Expand Up @@ -107,7 +107,7 @@ endfunction

function! s:ClearMatches()
call clearmatches()

if !exists('b:matchescache')
return
endif
Expand All @@ -122,9 +122,9 @@ function! s:VimCssInit(update)
if a:update==1
call s:ClearMatches()
endif
:set isk+=-
:set isk+=#
:set isk+=.
:setlocal iskeyword+=-
:setlocal iskeyword+=#
:setlocal iskeyword+=.

if len(keys(b:color_pattern))>0
call s:RestoreColors()
Expand Down Expand Up @@ -298,9 +298,9 @@ function! s:AdditionalColors()
\'yellowgreen': '#9acd32'
\}

"let w:colorDictRegExp = '\('
"let w:colorDictRegExp = '\('
for _color in keys(w:colorDict)
"let w:colorDictRegExp.='\<'._color.'\>\|'
"let w:colorDictRegExp.='\<'._color.'\>\|'
call s:MatchColorValue(strpart(w:colorDict[tolower(_color)], 1), '\<\c'._color.'\>')
endfor
"let w:colorDictRegExp=strpart(w:colorDictRegExp, 0, len(w:colorDictRegExp)-2).'\)\c'
Expand Down

0 comments on commit 304ced6

Please sign in to comment.