Proper 'define' support

Guessing I'm going to get some push back on the iskeyword tweak, but man
is this useful.  Press [d on a variable to see its value.  Press [<C-D>
on a mixin to jump to its definition.  Placeholder classes and functions
work too.
This commit is contained in:
Tim Pope
2018-05-17 00:46:14 -04:00
parent 8a238367f0
commit 46ef33e675

View File

@@ -9,15 +9,18 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<"
let b:undo_ftplugin = "setl com< cms< def< inc< inex< isk< ofu< sua<"
setlocal comments=://
setlocal commentstring=//\ %s
setlocal define=^\\s*\\%(@mixin\\\|=\\)
setlocal includeexpr=SassIncludeExpr(v:fname)
setlocal iskeyword+=-
setlocal iskeyword+=$
setlocal iskeyword+=%
setlocal omnifunc=csscomplete#CompleteCSS
setlocal suffixesadd=.sass,.scss,.css
let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@='
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
function! SassIncludeExpr(file) abort