Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
49d46bf
feat(conceal): add arrow_function option
Delapouite Sep 23, 2015
de7a60c
Add dollar sign to jsDocParam matches
vccortez Oct 1, 2015
4c983ba
Add common DOM Functions
simono Oct 6, 2015
7b9e11a
Make arrow-functions one-liners
wchargin Dec 31, 2015
70c6210
Merge pull request #339 from WChargin/arrow-functions
davidchambers Dec 31, 2015
c024f95
Respect 'very-magic' in 'jsAssignmentExpr' regexp
wchargin Jan 1, 2016
cbe6663
Merge pull request #340 from WChargin/fix-jsAssignmentExpr
davidchambers Jan 2, 2016
06326d5
Merge pull request #306 from Delapouite/arrow
davidchambers Jan 8, 2016
ca58cdd
Fix nested template variable syntax highlighting
Jan 9, 2016
ee412e3
Add jsComment to jsFuncArgs
Jan 19, 2016
c4fda05
Merge pull request #344 from whitneyit/feature/support-comment-in-fun…
davidchambers Jan 19, 2016
f41da19
Add jsLineComment to jsFuncArgs
Jan 19, 2016
63fdf23
Merge pull request #345 from whitneyit/feature/add-line-comment-support
davidchambers Jan 19, 2016
68290c3
make the m variable script-local
Jan 26, 2016
91fa38c
Merge pull request #347 from artm/localize-m
amadeus Jan 27, 2016
32137f1
Use shfitwidth() instead of &sw in indent/javascript.vim
zbinlin Jan 29, 2016
bc74a6f
Added Buffer to jsGlobalObjects
damionvega Feb 14, 2016
2b4d3a9
Merge pull request #352 from damionvega/buffer-to-global
davidchambers Feb 14, 2016
f099955
Merge pull request #342 from kevinfahy/bug-nested-template-strings
qstrahl Feb 22, 2016
dbacf7e
Merge pull request #313 from simono/feature/add-jsDomElemFuncs
qstrahl Feb 22, 2016
412bdd5
Merge pull request #309 from vekat/develop
qstrahl Feb 22, 2016
55da36b
Merge pull request #348 from zbinlin/sw
qstrahl Feb 22, 2016
62c15f6
Issue #294 better one line scope
camsteffen Sep 7, 2015
47b89fb
Merge pull request #293 from camsteffen/develop
qstrahl Feb 22, 2016
fd99d77
Adding first pass at ES6 Class support
amadeus Mar 5, 2016
995183b
ES6 Class Fixes
amadeus Mar 5, 2016
43784bc
Added jsduck documentation types
juneidy Dec 21, 2015
559c5f4
Merge pull request #337 from juneidysoo/develop
davidchambers Mar 9, 2016
152f36e
Merge pull request #354 from amadeus/es6-class-support
amadeus Mar 9, 2016
a57c0a1
Higher specificity for jsTemplate braces
amadeus Apr 4, 2016
1ec6674
Merge pull request #359 from amadeus/js-template-braces
amadeus Apr 4, 2016
7323233
Improvements to rest highlighting
amadeus Apr 4, 2016
22f9a02
Merge pull request #360 from amadeus/update-spread-matching
amadeus Apr 4, 2016
c1ea110
Adding jsFuncBlock support
amadeus Apr 3, 2016
ae177c4
First pass at handling lamba arguments
amadeus Apr 4, 2016
91f860b
Linking jsArrowFuncArgs to jsFuncArgs
amadeus Apr 4, 2016
82473d0
Allow ... in arrow arguments definition
amadeus Apr 4, 2016
6590bbc
Fix Generator definitions
amadeus Apr 4, 2016
d87bcd1
Merge pull request #358 from amadeus/arrow-functions
amadeus Apr 4, 2016
d8c18d9
Fix Comment Regions
amadeus Apr 4, 2016
36f34b2
Improved function declaration destructuring
amadeus Apr 4, 2016
113abc2
Fix jsBlock vs jsFuncBlock priority
amadeus Apr 6, 2016
2d11ec0
Merge pull request #363 from amadeus/misc-fixes
amadeus Apr 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ Default Value: 0
You can customize concealing characters by defining one or more of the following
variables:

let g:javascript_conceal_function = "ƒ"
let g:javascript_conceal_null = "ø"
let g:javascript_conceal_this = "@"
let g:javascript_conceal_return = "⇚"
let g:javascript_conceal_undefined = "¿"
let g:javascript_conceal_NaN = "ℕ"
let g:javascript_conceal_prototype = "¶"
let g:javascript_conceal_static = "•"
let g:javascript_conceal_super = "Ω"
let g:javascript_conceal_function = "ƒ"
let g:javascript_conceal_null = "ø"
let g:javascript_conceal_this = "@"
let g:javascript_conceal_return = "⇚"
let g:javascript_conceal_undefined = "¿"
let g:javascript_conceal_NaN = "ℕ"
let g:javascript_conceal_prototype = "¶"
let g:javascript_conceal_static = "•"
let g:javascript_conceal_super = "Ω"
let g:javascript_conceal_arrow_function = "⇒"

## Contributing

Expand Down
53 changes: 32 additions & 21 deletions indent/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ endif
let s:cpo_save = &cpo
set cpo&vim

" Get shiftwidth value
if exists('*shiftwidth')
func s:sw()
return shiftwidth()
endfunc
else
func s:sw()
return &sw
endfunc
endif

" 1. Variables {{{1
" ============

Expand Down Expand Up @@ -55,7 +66,7 @@ let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\|[^=]
" TODO: this needs to deal with if ...: and so on
let s:msl_regex = s:continuation_regex.'|'.s:expr_case

let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term
let s:one_line_scope_regex = '\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(.*)\)' . s:line_term

" Regex that defines blocks.
let s:block_regex = '\%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
Expand All @@ -68,15 +79,15 @@ let s:comma_last = ',\s*$'
let s:ternary = '^\s\+[?|:]'
let s:ternary_q = '^\s\+?'

let s:case_indent = &sw
let s:case_indent_after = &sw
let m = matchlist(&cinoptions, ':\(.\)')
if (len(m) > 2)
let s:case_indent = m[1]
let s:case_indent = s:sw()
let s:case_indent_after = s:sw()
let s:m = matchlist(&cinoptions, ':\(.\)')
if (len(s:m) > 2)
let s:case_indent = s:m[1]
endif
let m = matchlist(&cinoptions, '=\(.\)')
if (len(m) > 2)
let s:case_indent_after = m[1]
let s:m = matchlist(&cinoptions, '=\(.\)')
if (len(s:m) > 2)
let s:case_indent_after = s:m[1]
endif
" 2. Auxiliary Functions {{{1
" ======================
Expand Down Expand Up @@ -201,9 +212,9 @@ function s:GetVarIndent(lnum)

" if the previous line doesn't end in a comma, return to regular indent
if (line !~ s:comma_last)
return indent(prev_lnum) - &sw
return indent(prev_lnum) - s:sw()
else
return indent(lvar) + &sw
return indent(lvar) + s:sw()
endif
endif

Expand Down Expand Up @@ -342,7 +353,7 @@ function GetJavascriptIndent()
return indent(prevline)
" otherwise we indent 1 level
else
return indent(lvar) + &sw
return indent(lvar) + s:sw()
endif
endif
endif
Expand All @@ -361,7 +372,7 @@ function GetJavascriptIndent()

" If the line is comma first, dedent 1 level
if (getline(prevline) =~ s:comma_first)
return indent(prevline) - &sw
return indent(prevline) - s:sw()
endif
if (getline(prevline) =~ s:expr_case)
return indent(prevline) + s:case_indent_after
Expand All @@ -371,7 +382,7 @@ function GetJavascriptIndent()
if (getline(prevline) =~ s:ternary_q)
return indent(prevline)
else
return indent(prevline) + &sw
return indent(prevline) + s:sw()
endif
endif

Expand Down Expand Up @@ -413,9 +424,9 @@ function GetJavascriptIndent()
" If the previous line ended with a block opening, add a level of indent.
if s:Match(lnum, s:block_regex)
if (line =~ s:expr_case)
return indent(s:GetMSL(lnum, 0)) + &sw/2
return indent(s:GetMSL(lnum, 0)) + s:sw()/2
else
return indent(s:GetMSL(lnum, 0)) + &sw
return indent(s:GetMSL(lnum, 0)) + s:sw()
endif
endif

Expand All @@ -428,12 +439,12 @@ function GetJavascriptIndent()
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$')
return ind + &sw
return ind + s:sw()
else
return virtcol('.')
endif
elseif counts[1] == '1' || counts[2] == '1'
return ind + &sw
return ind + s:sw()
else
call cursor(v:lnum, vcol)
end
Expand All @@ -443,18 +454,18 @@ function GetJavascriptIndent()
" --------------------------

let ind_con = ind
let ind = s:IndentWithContinuation(lnum, ind_con, &sw)
let ind = s:IndentWithContinuation(lnum, ind_con, s:sw())

" }}}2
"
"
let ols = s:InOneLineScope(lnum)
if ols > 0
let ind = ind + &sw
let ind = ind + s:sw()
else
let ols = s:ExitingOneLineScope(lnum)
while ols > 0 && ind > 0
let ind = ind - &sw
let ind = ind - s:sw()
let ols = s:InOneLineScope(ols - 1)
endwhile
endif
Expand Down
Loading