JavaScript and TypeScript bundle for vim, this bundle provides syntax highlighting and improved indentation.
Note: This is my personal fork of pangloss/vim-javascript that removes flow support and adds TypeScript instead. Other than that, it should match the origin and I will mostly be pulling from there and trying to submit any other changes upstream.
git clone https://github.com/vieira/vim-javascript.git ~/.vim/pack/vim-javascript/start/vim-javascript
since Vim 8.
Install with pathogen
git clone https://github.com/vieira/vim-javascript.git ~/.vim/bundle/vim-javascript
alternatively, use a package manager like vim-plug
Using with MaxMEllon/vim-jsx-pretty
cd after/
cp ftplugin/typescriptreact.vim ftplugin/typescript.vim
cp syntax/typescriptreact.vim syntax/typescript.vim
cp indent/typescriptreact.vim syntax/typescript.vim
Edit syntax/tsx.vim
and add the block if hlexists("tsNoise")
below the if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
:
if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
finish
endif
if hlexists("tsNoise") " vieira/vim-javascript
runtime syntax/jsx.vim
finish
endif
Edit indent/tsx.vim
and remove the line runtime! indent/typescript.vim
.
Using with jparise/vim-graphql
cd after/syntax/typescript
Edit graphql.vim
and replace simply with:
runtime! after/syntax/javascript/graphql.vim
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.
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
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.
: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'
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!
Distributed under the same terms as Vim itself. See :help license
.