13
votes
How to auto fix common linting errors reported via syntastic?
As mentioned in the comments be aware of the consequences this modification has to you work environment (know exactly which eslint rules you use to "fix" things).
To answer your question: adding the ...
8
votes
Minimal to effort to have a JS beautifier on vim
I recommend filtering your buffer/file through a node module called js-beautify (also available as a python module):
:%!js-beautify -f - " whole buffer
:'<,'>!js-beautify -f - " ...
7
votes
How to auto fix common linting errors reported via syntastic?
The solution given in Jepz's answer didn't completely work for me. eslint was correctly called with the --fix option. However, maybe it's because of internals that have changed, but it seems like ...
6
votes
How can I run javascript directly and show the output?
I think Codi is what you are looking for. It supports JavaScript and some other languages.
5
votes
How can I run javascript directly and show the output?
No plugin required! You can run node with the shell command :!
Run the entire file with :!/usr/local/bin/node %
Run the current line with :exec '!/usr/local/bin/node' '-e' shellescape(getline('.'))
5
votes
Accepted
How can I run javascript directly and show the output?
Per this vim wikia entry you could create a shell execution to new buffer script and then extend it to run your code using node.
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<...
4
votes
Accepted
How to pass a parameter to JSHint with Syntastic
Syntastic allows passing arguments directly to the checkers using the syntastic_<filetype>_<checker>_<option> variable name format. It supports global (g:) and buffer (b:) variants ...
4
votes
Accepted
Is there a way to tab through fields and values in a JSON file in Vim?
There is not native way to do this however a few mappings should do the trick.
Add the following to ~/.vim/after/ftplugin/javascript.vim:
nnoremap <buffer> <tab> :<c-u>call search('...
4
votes
Accepted
Is it possible to get tag navigation that works with RequireJS?
Built-in definition search
Vim is able to follow "includes" for completion and for navigation. What constitutes an "include" can be defined with the 'include' option.
Sadly, Vim's include mechanism ...
4
votes
VIM How to enable .ts .tsx .js (for front-end) code highlight?
The best thing to do is enable filetype detection:
filetype on
Vim defaults to setting .tsx files as typescriptreact (8.1.2100 for me at least).
To enable filetype-plugins and indent scripts (...
4
votes
VIM How to enable .ts .tsx .js (for front-end) code highlight?
I tried to use
augroup SyntaxSettings
autocmd!
autocmd BufNewFile,BufRead *.tsx set filetype=typescript
augroup END
and it works.
4
votes
Accepted
How to manually install pangloss JavaScript plugin?
TL;DR Use :h packages
You will need
the plugin code (github is easiest, though if you just have a copy of the
source tree lying around, that works too)
A brief history of time managing plugins1
I ...
3
votes
Are there color variables for various programming languages?
A "color scheme" is not language-specific. Every file will use the same color scheme. Here's an old question with some good answers on creating your own color scheme, though, if that's ...
3
votes
Accepted
How to jump to the location which [I points to?
That feature is built-in, it has nothing to do with that "node" plugin. It's called "include search" and you can read all about it in :help include-search.
You have a few ways to jump to an item in ...
3
votes
Vim auto indentation
Ok, I've figured out a way to do this in my environment. I had to shrink and cut pangloss vim-javascript a little bit. Here's my fork:
https://github.com/seavan/vim-javascript-plus
You should ...
2
votes
How do I get matchit to work with '/>' (self-closed tags)?
Instead of using the above config, you can easily use a< from visual mode to select around closing tag, i< to select inner a closing tag.
2
votes
Accepted
Is there a workflow to preview javascript/html/css projects inside the browser?
What you are looking for has nothing to do with Vim or any editor you are using, you want a tool like grunt.js. Grunt is a task runner that you can configure to do a lot of things automatically, ...
2
votes
I want to save my typescript file, and immediately run tsc myfile.ts from inside vim. What is the best way to accomplish this?
The usual way to compile from Vim is to use :make. From :h :make:
:mak[e][!] [arguments] 1. All relevant |QuickFixCmdPre| autocommands are
executed.
2. If the 'autowrite' ...
1
vote
Accepted
How to set prettier indents?
For anyone who is facing a similar issue, when you use the prettier extension via coc-prettier, you need to put the configuration options inside the coc-settings.json file.
To solve my issue of ...
1
vote
Accepted
vim-test :TestSuite return message Not a test file
So I found the issue and a workaround. The issue is on Windows the path separator is \ and not / as is written in the code.
There is also a Windows in jasmine.vim when using the jasmine executable ...
1
vote
'filetype plugin indent on' breaks indention
What if you just enable the filetype plugin?
filetype plugin on
1
vote
Accepted
Sophisticated autocompletion in Vim in a VScode manner
What you want is to use a Language Server through the Language Server Protocol (LSP).
Read more about it on Wikipedia or on the official website.
As the Wikipedia article points out:
The Language ...
1
vote
Is there a workflow to preview javascript/html/css projects inside the browser?
Atom is the only editor I know of that has that capability built-in. You'll need to bring in third party tools. I did some research on a related topic some time back as I was looking for real-time ...
1
vote
Accepted
Enabling Syntax in Vim Creates Lag
Vim-polyglot
vim-polyglot contains what it calls 'language packs', which are sets of syntax, ftplugin, and other files that 'enhance' the experience of working with a particular language. These files ...
1
vote
How can I change Javascript syntax to higlight objects?
Try plugin https://github.com/jaxbot/semantic-highlight.vim (see also the article).
To install (with Plug plugin manager), set in .vimrc
Plug 'jaxbot/semantic-highlight.vim'
Default colors fight ...
1
vote
Accepted
Configure JavaScript indentation to indent keys object literals
As of 2016-12-16, the javascript.vim indenter will break if you set nomagic.
The current workaround is to not use set nomagic.
1
vote
Accepted
How do I get matchit to work with '/>' (self-closed tags)?
Let's suppose you have the following lines in your ~/.vimrc
source $VIMRUNTIME/macros/matchit.vim
filetype plugin on
If the offending lines are in a .html file, then:
b:match_words = '<:>,' ....
1
vote
How to view javascript tags in vim using tagbar + jsctags + tern_for_vim + ctags_exuberant?
I've developed a set of CTAGS regex rules for JavaScript and CoffeeScript. My rules include unit tests so I think they are more reliable than most.
Here's my git repo which should be most up to date:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
filetype-javascript × 40syntax-highlighting × 9
indentation × 6
neovim × 4
vimrc × 3
comments × 3
vimscript × 2
microsoft-windows × 2
formatting × 2
ctags × 2
filetype-html × 2
plugin-syntastic × 2
key-bindings × 1
command-line × 1
terminal × 1
autocmd × 1
autocompletion × 1
colorscheme × 1
cursor-motions × 1
external-command × 1
folding × 1
plugin-system × 1
filetype × 1
quickfix × 1
plugin-you-complete-me × 1