Permalink
Browse files

remove indenting of user functions, fixes #1

  • Loading branch information...
1 parent b6e34f0 commit 72f629f81f4d32f94b16b7e0d867bdb2a1467265 @wavded committed May 1, 2011
Showing with 11 additions and 11 deletions.
  1. +11 −11 indent/stylus.vim
View
@@ -20,18 +20,18 @@ if exists("*GetStylusIndent") " only define once
endif
function! GetStylusIndent()
- let lnum = prevnonblank(v:lnum-1)
+ let lnum = prevnonblank(v:lnum-1)
if lnum == 0
return 0
endif
- let line = substitute(getline(lnum),'\s\+$','','') " get last line strip ending whitespace
- let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') " get current line, trimmed
- let lastcol = strlen(line) " get last col in prev line
- let line = substitute(line,'^\s\+','','') " then remove preceeding whitespace
- let indent = indent(lnum) " get indent on prev line
- let cindent = indent(v:lnum) " get indent on current line
+ let line = substitute(getline(lnum),'\s\+$','','') " get last line strip ending whitespace
+ let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') " get current line, trimmed
+ let lastcol = strlen(line) " get last col in prev line
+ let line = substitute(line,'^\s\+','','') " then remove preceeding whitespace
+ let indent = indent(lnum) " get indent on prev line
+ let cindent = indent(v:lnum) " get indent on current line
let increase = indent + &sw " increase indent by the shift width
- if indent == indent(lnum)
+ if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
@@ -40,9 +40,9 @@ function! GetStylusIndent()
" for debugging only
echo group
- if group !~? 'stylus.*' && line =~? ')\s*$' " match user functions
- return increase
- elseif group =~? '\v^%(cssTagName|cssClassName|cssIdentifier|cssSelectorOp|cssSelectorOp2|cssBraces|cssAttributeSelector|cssPseudoClass|cssPseudoClassId)$'
+ " if group !~? 'css.*' && line =~? ')\s*$' " match user functions
+ " return increase
+ if group =~? '\v^%(cssTagName|cssClassName|cssIdentifier|cssSelectorOp|cssSelectorOp2|cssBraces|cssAttributeSelector|cssPseudoClass|cssPseudoClassId)$'
return increase
else
return indent

0 comments on commit 72f629f

Please sign in to comment.