diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000..b1ddccb1
--- /dev/null
+++ b/ISSUE_TEMPLATE.md
@@ -0,0 +1,13 @@
+*Requisite minimal reproducible example, formatted as plain text :*
+
+
+
+#### Optional: concerning jsx.
+PLEASE PLEASE PLEASE make sure you have properly
+setup and are sourcing this plugin https://github.com/mxw/vim-jsx
+
+WE DO NOT support JSX automatically, you need another plugin to add get this
+functionality.
+
+Make sure the bug still exists if you disable all other javascript plugins
+except the one noted above, mxw/vim-jsx
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..81accf8c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,127 @@
+# vim-javascript
+
+JavaScript bundle for vim, this bundle provides syntax highlighting and
+improved indentation.
+
+
+## Installation
+
+### Install with native package manager
+
+ git clone https://github.com/pangloss/vim-javascript.git ~/.vim/pack/vim-javascript/start/vim-javascript
+
+since Vim 8.
+
+### Install with [pathogen](https://github.com/tpope/vim-pathogen)
+
+ git clone https://github.com/pangloss/vim-javascript.git ~/.vim/bundle/vim-javascript
+
+alternatively, use a package manager like [vim-plug](https://github.com/junegunn/vim-plug)
+
+
+## Configuration Variables
+
+The following variables control certain syntax highlighting plugins. You can
+add them to your `.vimrc` to enable their features.
+
+-----------------
+
+```
+let g:javascript_plugin_jsdoc = 1
+```
+
+Enables syntax highlighting for [JSDocs](http://usejsdoc.org/).
+
+Default Value: 0
+
+-----------------
+
+```
+let g:javascript_plugin_ngdoc = 1
+```
+
+Enables some additional syntax highlighting for NGDocs. Requires JSDoc plugin
+to be enabled as well.
+
+Default Value: 0
+
+-----------------
+
+```
+let g:javascript_plugin_flow = 1
+```
+
+Enables syntax highlighting for [Flow](https://flowtype.org/).
+
+Default Value: 0
+
+-----------------
+
+```vim
+augroup javascript_folding
+ au!
+ au FileType javascript setlocal foldmethod=syntax
+augroup END
+```
+
+Enables code folding for javascript based on our syntax file.
+
+Please note this can have a dramatic effect on performance. In some terminals
+this may cause hangs during pasting. If you are affected by this, using
+a different foldmethod (such as indent) may provide a better experience.
+
+
+## Concealing Characters
+
+You can customize concealing characters, if your font provides the glyph you want, 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_arrow_function = "⇒"
+ let g:javascript_conceal_noarg_arrow_function = "🞅"
+ let g:javascript_conceal_underscore_arrow_function = "🞅"
+
+
+You can enable concealing within VIM with:
+
+ set conceallevel=1
+
+OR if you wish to toggle concealing you may wish to bind a command such as the following which will map `l` (leader is usually the `\` key) to toggling conceal mode:
+
+ map l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"
+
+
+## Indentation Specific
+
+* `:h cino-:`
+* `:h cino-=`
+* `:h cino-star`
+* `:h cino-(`
+* `:h cino-w`
+* `:h cino-W`
+* `:h cino-U`
+* `:h cino-m`
+* `:h cino-M`
+* `:h 'indentkeys'`
+
+## Contributing
+
+Please follow the general code style
+guides (read the code) and in your pull request explain the reason for the
+proposed change and how it is valuable. All p.r.'s will be reviewed by a
+maintainer(s) then, hopefully, merged.
+
+Thank you!
+
+
+## License
+
+Distributed under the same terms as Vim itself. See `:help license`.
diff --git a/Rakefile b/Rakefile
deleted file mode 100644
index c6223ba2..00000000
--- a/Rakefile
+++ /dev/null
@@ -1,89 +0,0 @@
-require 'rake'
-require 'rake/clean'
-
-files = ['syntax/javascript.vim', 'indent/javascript.vim']
-
-CLEAN.include 'tmp/*_ctags'
-
-desc "Make zip file"
-file 'javascript.zip' => files do |t|
- File.unlink t.name if File.exists?(t.name)
- system('zip','-q',t.name,*t.prerequisites)
-end
-
-desc "Make vimball"
-file 'javascript.vba' => files do |t|
- File.unlink t.name if File.exists?(t.name)
- File.open(t.name,"w") do |out|
- out.puts '" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.'
- out.puts 'UseVimball'
- out.puts 'finish'
- t.prerequisites.each do |name|
- File.open(name) do |file|
- file.each_line {}
- out.puts name
- out.puts file.lineno
- file.rewind
- file.each_line {|l|out.puts l}
- end
- end
- end
-end
-
-desc "Install"
-task :install do
- vimfiles = if ENV['VIMFILES']
- ENV['VIMFILES']
- elsif RUBY_PLATFORM =~ /(win|w)32$/
- File.expand_path("~/vimfiles")
- else
- File.expand_path("~/.vim")
- end
-
- puts "Installing javascript.vim"
- files.each do |file|
- target_file = File.join(vimfiles, file)
- FileUtils.mkdir_p(File.dirname(target_file))
- FileUtils.rm(target_file) rescue nil
- FileUtils.cp(file, target_file)
- puts " Copied #{file} to #{target_file}"
- end
-end
-
-desc "Copy ~/.ctags to tmp/original_ctags"
-task :get_original_ctags do
- if File.exists?(File.expand_path("~/.ctags"))
- File.unlink('tmp/original_ctags') if File.exists?('tmp/original_ctags')
- FileUtils.cp(File.expand_path("~/.ctags"), 'tmp/original_ctags')
- elsif not File.exists?("tmp/original_ctags")
- File.open("tmp/original_ctags", "w") { }
- end
-end
-
-desc "Combine tmp/original_ctags and extras/ctags"
-file 'tmp/combined_ctags' => ['tmp/original_ctags', 'extras/ctags'] do |t|
- begin_string = '# Begin vim-javascript generated section'
- end_string = '# End vim-javascript generated section'
- File.unlink t.name if File.exists?(t.name)
- File.open(t.name,"w") do |out|
- orig = File.read('tmp/original_ctags')
- orig.each_line.inject(true) do |can_print, line|
- can_print = false if line.chomp == begin_string
- out.puts line if can_print
- can_print or line.chomp == end_string
- end
- out.puts begin_string
- out.puts "# generated at #{ Time.now }"
- out.puts File.read('extras/ctags')
- out.puts end_string
- end
-end
-
-desc "Add better javascript support to ctags"
-task :ctags => [:get_original_ctags, 'tmp/combined_ctags'] do
- FileUtils.cp('tmp/combined_ctags', File.expand_path('~/.ctags'))
-end
-
-task 'zip' => 'javascript.zip'
-task 'vimball' => 'javascript.vba'
-task :default => [:zip, :vimball]
diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim
new file mode 100644
index 00000000..c6c42d60
--- /dev/null
+++ b/after/ftplugin/javascript.vim
@@ -0,0 +1,12 @@
+" Vim filetype plugin file
+" Language: JavaScript
+" Maintainer: vim-javascript community
+" URL: https://github.com/pangloss/vim-javascript
+
+setlocal iskeyword+=$ suffixesadd+=.js
+
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<'
+else
+ let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
+endif
diff --git a/compiler/eslint.vim b/compiler/eslint.vim
new file mode 100644
index 00000000..7695a072
--- /dev/null
+++ b/compiler/eslint.vim
@@ -0,0 +1,16 @@
+" Vim compiler plugin
+" Language: JavaScript
+" Maintainer: vim-javascript community
+" URL: https://github.com/pangloss/vim-javascript
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "eslint"
+
+if exists(":CompilerSet") != 2
+ command! -nargs=* CompilerSet setlocal
+endif
+
+CompilerSet makeprg=eslint\ -f\ compact\ %
+CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m
diff --git a/extras/flow.vim b/extras/flow.vim
new file mode 100644
index 00000000..b34d7101
--- /dev/null
+++ b/extras/flow.vim
@@ -0,0 +1,109 @@
+syntax region jsFlowDefinition contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen
+syntax region jsFlowArgumentDef contained start=/:/ end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster
+syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster,jsComment fold
+syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster,jsComment fold
+syntax region jsFlowExactObject contained matchgroup=jsFlowNoise start=/{|/ end=/|}/ contains=@jsFlowCluster,jsComment fold
+syntax region jsFlowParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster nextgroup=jsFlowArrow skipwhite keepend extend fold
+syntax match jsFlowNoise contained /[:;,<>]/
+syntax keyword jsFlowType contained boolean number string null void any mixed JSON array Function object array bool class
+syntax keyword jsFlowTypeof contained typeof skipempty skipwhite nextgroup=jsFlowTypeCustom,jsFlowType
+syntax match jsFlowTypeCustom contained /[0-9a-zA-Z_.]*/ skipwhite skipempty nextgroup=jsFlowGeneric
+syntax region jsFlowGeneric matchgroup=jsFlowNoise start=/\k\@<= end=/>/ contains=@jsFlowCluster containedin=@jsExpression,jsFlowDeclareBlock
+syntax region jsFlowGeneric contained matchgroup=jsFlowNoise start=/ end=/>(\@=/ oneline contains=@jsFlowCluster containedin=@jsExpression,jsFlowDeclareBlock
+syntax region jsFlowObjectGeneric contained matchgroup=jsFlowNoise start=/\k\@<= end=/>/ contains=@jsFlowCluster nextgroup=jsFuncArgs
+syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens
+syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject
+syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster
+syntax keyword jsFlowImportType contained type typeof skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup
+syntax match jsFlowWildcard contained /*/
+
+syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster,jsFlowArrow,jsFlowReturnParens
+syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp extend fold
+syntax region jsFlowReturnArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp fold
+syntax region jsFlowReturnParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp,jsFlowReturnArrow fold
+syntax match jsFlowReturnArrow contained /=>/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
+syntax match jsFlowReturnKeyword contained /\k\+/ contains=jsFlowType,jsFlowTypeCustom skipwhite skipempty nextgroup=jsFlowReturnGroup,jsFuncBlock,jsFlowReturnOrOp,jsFlowReturnArray
+syntax match jsFlowReturnMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowReturnKeyword,jsFlowReturnObject,jsFlowReturnParens
+syntax region jsFlowReturnGroup contained matchgroup=jsFlowNoise start=/ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
+syntax match jsFlowReturnOrOp contained /\s*|\s*/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
+syntax match jsFlowWildcardReturn contained /*/ skipwhite skipempty nextgroup=jsFuncBlock
+syntax keyword jsFlowTypeofReturn contained typeof skipempty skipwhite nextgroup=@jsFlowReturnCluster
+
+syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
+syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
+syntax region jsFlowClassFunctionGroup contained matchgroup=jsFlowNoise start=/ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
+syntax match jsFlowObjectFuncName contained /\<\K\k*<\@=/ skipwhite skipempty nextgroup=jsFlowObjectGeneric containedin=jsObject
+
+syntax region jsFlowTypeStatement start=/\(opaque\s\+\)\?type\%(\s\+\k\)\@=/ end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend
+syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/=/ end=/\%(;\|\n\%(\s*|\)\@!\)/ contains=@jsFlowCluster,jsFlowGeneric,jsFlowMaybe
+syntax match jsFlowTypeOperator contained /=/ containedin=jsFlowTypeValue
+syntax match jsFlowTypeOperator contained /=/
+syntax keyword jsFlowTypeKeyword contained type
+
+syntax keyword jsFlowDeclare declare skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface
+syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlowClassDef containedin=jsClassBlock
+syntax region jsFlowClassDef contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassValue
+
+syntax region jsFlowModule contained start=/module/ end=/\%({\|:\)\@=/ skipempty skipwhite nextgroup=jsFlowDeclareBlock contains=jsString
+syntax region jsFlowInterface contained start=/interface/ end=/{\@=/ skipempty skipwhite nextgroup=jsFlowInterfaceBlock contains=@jsFlowCluster
+syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise fold
+
+syntax match jsFlowMaybe contained /?/
+syntax region jsFlowInterfaceBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsFlowObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise,jsFlowParens,jsFlowGeneric keepend fold
+
+syntax region jsFlowParenAnnotation contained start=/:/ end=/[,=)]\@=/ containedin=jsParen contains=@jsFlowCluster
+
+syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp,jsFlowWildcardReturn,jsFlowReturnArrow,jsFlowTypeofReturn
+syntax cluster jsFlowCluster contains=jsFlowArray,jsFlowObject,jsFlowExactObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGeneric,jsFlowMaybe,jsFlowParens,jsFlowOrOperator,jsFlowWildcard
+
+if version >= 508 || !exists("did_javascript_syn_inits")
+ if version < 508
+ let did_javascript_syn_inits = 1
+ command -nargs=+ HiLink hi link
+ else
+ command -nargs=+ HiLink hi def link
+ endif
+ HiLink jsFlowDefinition PreProc
+ HiLink jsFlowClassDef jsFlowDefinition
+ HiLink jsFlowArgumentDef jsFlowDefinition
+ HiLink jsFlowType Type
+ HiLink jsFlowTypeCustom PreProc
+ HiLink jsFlowTypeof PreProc
+ HiLink jsFlowTypeofReturn PreProc
+ HiLink jsFlowArray PreProc
+ HiLink jsFlowObject PreProc
+ HiLink jsFlowExactObject PreProc
+ HiLink jsFlowParens PreProc
+ HiLink jsFlowGeneric PreProc
+ HiLink jsFlowObjectGeneric jsFlowGeneric
+ HiLink jsFlowReturn PreProc
+ HiLink jsFlowParenAnnotation PreProc
+ HiLink jsFlowReturnObject jsFlowReturn
+ HiLink jsFlowReturnArray jsFlowArray
+ HiLink jsFlowReturnParens jsFlowParens
+ HiLink jsFlowReturnGroup jsFlowGeneric
+ HiLink jsFlowFunctionGroup PreProc
+ HiLink jsFlowClassGroup PreProc
+ HiLink jsFlowClassFunctionGroup PreProc
+ HiLink jsFlowArrow PreProc
+ HiLink jsFlowReturnArrow PreProc
+ HiLink jsFlowTypeStatement PreProc
+ HiLink jsFlowTypeKeyword PreProc
+ HiLink jsFlowTypeOperator Operator
+ HiLink jsFlowMaybe PreProc
+ HiLink jsFlowReturnMaybe PreProc
+ HiLink jsFlowClassProperty jsClassProperty
+ HiLink jsFlowDeclare PreProc
+ HiLink jsFlowModule PreProc
+ HiLink jsFlowInterface PreProc
+ HiLink jsFlowNoise Noise
+ HiLink jsFlowObjectKey jsObjectKey
+ HiLink jsFlowOrOperator jsOperator
+ HiLink jsFlowReturnOrOp jsFlowOrOperator
+ HiLink jsFlowWildcard PreProc
+ HiLink jsFlowWildcardReturn PreProc
+ HiLink jsFlowImportType PreProc
+ HiLink jsFlowTypeValue PreProc
+ HiLink jsFlowObjectFuncName jsObjectFuncName
+ delcommand HiLink
+endif
diff --git a/extras/jsdoc.vim b/extras/jsdoc.vim
new file mode 100644
index 00000000..a7189d1b
--- /dev/null
+++ b/extras/jsdoc.vim
@@ -0,0 +1,40 @@
+"" syntax coloring for javadoc comments (HTML)
+syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
+
+" tags containing a param
+syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
+" tags containing type and param
+syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\|typedef\)\>" skipwhite nextgroup=jsDocType
+" tags containing type but no param
+syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|return\|returns\|yields\)\>" skipwhite nextgroup=jsDocTypeNoParam
+" tags containing references
+syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
+" other tags (no extra syntax)
+syntax match jsDocTags contained "@\(abstract\|access\|accessor\|async\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inherit[dD]oc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
+
+syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
+syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
+syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
+syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
+syntax region jsDocTypeNoParam contained start="{" end="}" oneline
+syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
+syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\~\|\.\|:\|\/\|\[.\{-}]\|=\)\+"
+
+syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
+
+if version >= 508 || !exists("did_javascript_syn_inits")
+ if version < 508
+ let did_javascript_syn_inits = 1
+ command -nargs=+ HiLink hi link
+ else
+ command -nargs=+ HiLink hi def link
+ endif
+ HiLink jsDocTags Special
+ HiLink jsDocSeeTag Function
+ HiLink jsDocType Type
+ HiLink jsDocTypeBrackets jsDocType
+ HiLink jsDocTypeRecord jsDocType
+ HiLink jsDocTypeNoParam Type
+ HiLink jsDocParam Label
+ delcommand HiLink
+endif
diff --git a/extras/ngdoc.vim b/extras/ngdoc.vim
new file mode 100644
index 00000000..c513d875
--- /dev/null
+++ b/extras/ngdoc.vim
@@ -0,0 +1,3 @@
+syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
+syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
+syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
diff --git a/ftdetect/flow.vim b/ftdetect/flow.vim
new file mode 100644
index 00000000..3f1ea65b
--- /dev/null
+++ b/ftdetect/flow.vim
@@ -0,0 +1 @@
+autocmd BufNewFile,BufRead *.flow setfiletype flow
diff --git a/ftdetect/javascript.vim b/ftdetect/javascript.vim
index e0708641..00487326 100644
--- a/ftdetect/javascript.vim
+++ b/ftdetect/javascript.vim
@@ -1,2 +1,8 @@
-au BufNewFile,BufRead *.js setf javascript
-au BufNewFile,BufRead Jakefile setf javascript
+fun! s:SelectJavascript()
+ if getline(1) =~# '^#!.*/bin/\%(env\s\+\)\?node\>'
+ set ft=javascript
+ endif
+endfun
+
+autocmd BufNewFile,BufRead *.{js,mjs,cjs,jsm,es,es6},Jakefile setfiletype javascript
+autocmd BufNewFile,BufRead * call s:SelectJavascript()
diff --git a/indent/javascript.vim b/indent/javascript.vim
index b34deee4..b754e282 100644
--- a/indent/javascript.vim
+++ b/indent/javascript.vim
@@ -1,328 +1,477 @@
" Vim indent file
-" Language: Javascript
-" Maintainer: Darrick Wiebe
-" URL: http://github.com/pangloss/vim-javascript
-" Version: 1.0.0
-" Last Change: August 31, 2009
-" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
-
-" 0. Initialization {{{1
-" =================
+" Language: Javascript
+" Maintainer: Chris Paul ( https://github.com/bounceme )
+" URL: https://github.com/pangloss/vim-javascript
+" Last Change: December 4, 2017
" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
+if exists('b:did_indent')
finish
endif
let b:did_indent = 1
-setlocal nosmartindent
-
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent()
-setlocal indentkeys=0{,0},0),0],!^F,o,O,e
+setlocal autoindent nolisp nosmartindent
+setlocal indentkeys+=0],0)
+" Testable with something like:
+" vim -eNs "+filetype plugin indent on" "+syntax on" "+set ft=javascript" \
+" "+norm! gg=G" '+%print' '+:q!' testfile.js \
+" | diff -uBZ testfile.js -
+
+let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys< lisp<'
" Only define the function once.
-if exists("*GetJavascriptIndent")
+if exists('*GetJavascriptIndent')
finish
endif
let s:cpo_save = &cpo
set cpo&vim
-" 1. Variables {{{1
-" ============
+" indent correctly if inside