From 46ef33e675aad923955927cc086e6bb7646efb11 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 17 May 2018 00:46:14 -0400 Subject: [PATCH] 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 [ on a mixin to jump to its definition. Placeholder classes and functions work too. --- ftplugin/sass.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ftplugin/sass.vim b/ftplugin/sass.vim index ff68fe0..0b43a2d 100644 --- a/ftplugin/sass.vim +++ b/ftplugin/sass.vim @@ -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