Skip to content
Browse files

javascript indentation

  • Loading branch information...
1 parent a061f4b commit fbcbfa7de7660006a3b3914b144f5943c772729f @gabesoft committed Apr 24, 2012
Showing with 22 additions and 5 deletions.
  1. +4 −4 .bashrc
  2. +8 −1 .vim/indent/javascript.vim
  3. +10 −0 .vim/indent_test/indent_work2.js
View
8 .bashrc
@@ -62,11 +62,11 @@ alias svisudo='sudo visudo' # edit the sudoers file
# delete
alias ri='rm -i'
-alias rf='rm -f'
-alias rr='rm -f -r'
+alias rf='rm -fv'
+alias rr='rm -fv -r'
alias srm='sudo rm -i'
-alias srf='sudo rm -f'
-alias srr='sudo rm -f -r'
+alias srf='sudo rm -fv'
+alias srr='sudo rm -fv -r'
# copy move
alias cpi='cp -i'
View
9 .vim/indent/javascript.vim
@@ -554,10 +554,17 @@ function! s:FindVarStart(lnum, line)
if curr >= indent
let snum = s:FindBracketStart(indx, s:LastCloseBracket(line))
if snum != -1
- if s:OpenVar(s:GetLine(snum))
+ let line = s:GetLine(snum)
+
+ if s:OpenVar(line)
let lnum = snum
break
endif
+
+ if indx == a:lnum
+ let indent = s:IndentFwd(indent(snum), '', line)
+ endif
+
let indx = indx != snum ? snum : prevnonblank(indx - 1)
elseif (indx == a:lnum) || (!s:EndsWithSemi(line) && !s:OpenVar(line))
let indx = prevnonblank(indx - 1)
View
10 .vim/indent_test/indent_work2.js
@@ -1,3 +1,13 @@
+var count = contentIds.length, //
+ text = "{0} content item{1} moved from {2} to {3}", //
+ message = Ext.String.format(text, //
+ (count === 1 ? "One" : count), //
+ (count === 1 ? ' was' : 's were'), //
+ sourceFolder.get('text'), //
+ targetFolder.get('text')); //
+
+grid.remove(contentIds); //
+
thisIsAVeryLongVariableName = 'expressionPartOne' + someMethodThatIsLong() +
thisIsAnEvenLongerOtherFunctionNameThatCannotBeIndentedMore();

0 comments on commit fbcbfa7

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