Questions tagged [filetype-javascript]
Questions about the javascript file type
43
questions
0
votes
0
answers
21
views
Strange auto indent in Javascript in HTML
When writing Javascript in HTML, vim insists on autoindenting like this:
if( dur.match(/:/) ) {
let xs = dur.split(":")
if( xs.length > 3 ) ...
0
votes
0
answers
32
views
How to disable tsserver check on JS file
I am a newbie to neovim, so please bear with me.
I am using Mason to configure my LSP servers. For Javascript I use tsserver. However I am getting error/hint 'Could not find declaration file for ...
0
votes
1
answer
282
views
How can I easily configure my Neovim to provide a vs code like javascript, html & CSS autocomplete, intellisence & highlighting?
I am new to Neovim & overwhelmed by the extremely huge number of ways to configure it, which take hours & have no surity of working for me, as I am using Neovim on my Android via termux (for ...
0
votes
1
answer
42
views
Can't input dot and method in html?
Here is the test.html file which in editing status:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</...
1
vote
1
answer
495
views
Unable to use conceal with vim-javascript plugin
editor: NVIM v0.4.3
I have the following syntax file at ~/.config/nvim/after/syntax/javascript.vim
syntax clear javaScriptFunction
syntax match javaScriptFunction /\<module.exports\>/ ...
3
votes
1
answer
325
views
How can I change Javascript syntax to higlight objects?
I am trying to emulate the Atom JavaScript syntax highlighting in vim, but there are a few things missing.
Namely, I'd like to highlight objects and their chains in red. It'd be dandy if I could ...
1
vote
0
answers
358
views
Why does the syntax foldmethod not work even though syntax highlighting works?
Started editing a JavaScript file, did :set filetype=javascript (correct syntax highlighting kicked in), then set foldmethod=syntax, and naively expected that folding should automatically work, but ...
0
votes
2
answers
145
views
Are there color variables for various programming languages? [closed]
I know, in Vim I can get a list with variables for color themes with the command :hi.
But there are not the programming languages I need.
Is there a way to get specific color variables for JavaScript, ...
1
vote
1
answer
106
views
Is there a way to tab through fields and values in a JSON file in Vim?
Is there a way to tab through fields and values in a json file in Vim as you would form fields on a web form?
0
votes
1
answer
2k
views
Incorrect autocomplete with Javascript using nvim-lspconfig
My lspconfig works fine with typescript files, but not with Javascript.
Autocomplete shows .constructor and other standard props/methods instead of the expected ones defined on the type
This happens ...
1
vote
1
answer
2k
views
How can I execute mjs files (node.js modules) inside Vim with the terminal command?
Let's say I have a pure node.js file.js as the following:
const fs = require('fs')
console.log("Hello World")
If I execute it inside Vim with :%terminal node it works perfectly fine. I see ...
0
votes
1
answer
2k
views
How to set prettier indents?
I have set tabstop to 4.
But when I use prettier, it defaults my indentations to 2 spaces.
How do I change this?
I am using the coc prettier extension.
const thing = () => {
var hi = 1; //...
0
votes
1
answer
527
views
vim-test :TestSuite return message Not a test file
It's a really simple setup. I'm actually following along with the modern vim book. (I've been using vim emulation on IDEs for years and want to fully dive in).
Anyway, my project structure is:
...
0
votes
0
answers
263
views
Let .js files be recognized as .jsx files?
I just figured out how to combine those creepy plugins to work together to achieve the following auto-indent:
before / after pressing o:
But then this only works on file extension .jsx as shown above,...
13
votes
4
answers
12k
views
How can I run javascript directly and show the output?
I'm just doing some testing with JavaScript language feature with no DOM manipulation. So I'm editing a js file and I'm wondering how to simply run it and show the console output? I installed the moll/...
4
votes
0
answers
1k
views
Cannot set g:ale_fixers in ALE config on vim
I'm trying to config ALE in my vim and can't config the fixers, them aren't showing on ALEInfo.
I'm setting the config for typescript files (with and without react) with prettier and eslint.
What i'm ...
2
votes
2
answers
4k
views
VIM How to enable .ts .tsx .js (for front-end) code highlight?
I have .vimrc plugins
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'nanotech/jellybeans.vim'
" ...
1
vote
2
answers
1k
views
How do I get matchit to work with '/>' (self-closed tags)?
I really like to jump from one <el> to the end of </el> with matchit. I am using it for jsx, but it does not seem to work if I have an element that is declared with />, does anybody ...
2
votes
0
answers
375
views
Javascript syntax-highlight for JsDoc comments
I now use plugin vim-javascript just to have a nice syntax highlight for JsDoc comments in my Javascript files.
vim-javascript provides nice colors highlight but it conflict with all parentheses ...
1
vote
0
answers
105
views
Expanding region/selection for javascript
is there a way to configure https://github.com/terryma/vim-expand-region (or any other plugin) to work with js,jsx,ts,tsx files?
I'm new to vim, I'm not sure what to do.
The mentioned plugin is not ...
1
vote
0
answers
361
views
Neovim highlight syntax region inside typescript tagged template literal
I am having trouble fixing a syntax plugin for Vim. I've found a bug in a plugin that has not been touched in a fair amount of time. I want to address it myself but I believe I am lacking in a lot of ...
0
votes
1
answer
461
views
I want to save my typescript file, and immediately run tsc myfile.ts from inside vim. What is the best way to accomplish this?
I am building a daemon, and nodemon currently monitors a file called server.js, which is compiled from the file I am working on, server.ts
In order to compile server.ts, after saving with :w, I need ...
2
votes
0
answers
630
views
Smart and auto indent not indenting as expected for JSX
I'm trying to figure out how to get vim to correctly indent the next line in a JSX block.
Currently when I press enter, the cursor goes slightly behind where it should be. In the example below, my ...
1
vote
1
answer
266
views
Sophisticated autocompletion in Vim in a VScode manner
I'm currently switching to Vim as my main text editing tool and I try to investigate if it is possible to make Vim behave like VScode when it comes to autocompletion. I got really used to the way ...
3
votes
1
answer
146
views
How to manually install pangloss JavaScript plugin?
If possible, I would prefer to not start using a package manager for now.
I'm trying to manually install this plugin for editing JS files: https://github.com/pangloss/vim-javascript
I have looked ...
15
votes
2
answers
9k
views
How to auto fix common linting errors reported via syntastic?
I started using syntastic plugin with vim to report lint errors in my javascript code.
I also integrated eslint with syntastic, and it shows me nice errors, warnings in case they are present as per ...
0
votes
1
answer
141
views
'filetype plugin indent on' breaks indention [closed]
Using vim 8.*, I am using these plugins:
html5.vim
polymer-ide.vim
supertab
vim-javascript
In my vimrc.local file if I enable filetype plugin indent on it breaks my javaScript indention but makes the ...
1
vote
1
answer
468
views
Enabling Syntax in Vim Creates Lag
I was trying to learn javascript the other day and was using emacs as I have been trying to learn emacs as well. But after sometimes my left wrist started to hurt(as one's does) so I switched to ...
1
vote
0
answers
33
views
My C like Comments include markdown, can I have vim highlight those in my JavaScript (Node.js) code? [duplicate]
I write a lot of C/C++ and get highlighting for my Doxygen docs in my comments. It's not perfect, but it sure helps avoiding many very simple mistakes on the spot.
To handle that, I simply have the ...
0
votes
2
answers
611
views
Is there a workflow to preview javascript/html/css projects inside the browser? [closed]
Is there a way to preview js/html/css projects inside a browser, just like the Atom-Live-Server. So, I am after a server-client way of doing this, I mean in realtime as the files are being edited.
...
2
votes
1
answer
462
views
Configure JavaScript indentation to indent keys object literals
I'm using vim version 8.0 on OS X (installed through Homebrew) and it keeps indenting object literals wrong. The first key and only the first key is flush with the previous line. All subsequent keys ...
1
vote
0
answers
190
views
Indentation in three piece comments in javascript
I use Vim 7.4.2149 and the plugin pangloss/vim-javascript for js indentation. I need to get comments like:
/*
*
*/
But instead I get:
/*
*
*
*/
I'm not really interested in syntax ...
1
vote
1
answer
440
views
Why vim-jsbeautify cannot find module?
I'm using vim in cygwin, I want to use https://github.com/maksimr/vim-jsbeautify to format my javascript code.
but whenever I use :call JsBeautify(), there's an error thrown:
E117: Unknown function:...
7
votes
2
answers
2k
views
How to view javascript tags in vim using tagbar + jsctags + tern_for_vim + ctags_exuberant?
I'm writing javascript code using vim and I really like to have outline view for the current javascript file I'm editing. I find tagbar is the popular plugin for this purpose. And on its wiki, for ...
2
votes
1
answer
585
views
Minimal to effort to have a JS beautifier on vim
My research hints that there is no way to have a JS file properly formatted without going through installations.
I wonder whether there is a minimal effort way of doing it in vim.
What are your ...
5
votes
1
answer
780
views
Vim auto indentation
I am using Vim with Pathogen, vim-jsx, and vim-javascript.
I have trouble getting the correct indentation. When I am breaking one line that is too long into several pieces (without adding new blocks),...
1
vote
1
answer
366
views
How to pass a parameter to JSHint with Syntastic
I need to pass a paramter (-extract) to the jshint syntax checker such that it extracts JavaScript from HTML before checking. Unfortunatly I have no idea how to do that for syntastic.
1
vote
1
answer
800
views
Is it possible to get tag navigation that works with RequireJS?
Are there any features/plugins/external tools which can be used to get tag navigation that understands RequireJS imports?
1
vote
0
answers
184
views
Using single quotes blows up syntax formatting in .js
Just noticed that using single quotes in javascript blows up automatic formatting sometimes:
See the public/sass/*.sass line:
Double quotes:
gulp.task('compile-sass', function(){
gulp
.src("...
2
votes
1
answer
93
views
How to jump to the location which [I points to?
I've installed node plugin, which give possibility to display all lines that contain the keyword under the cursor using [I hotkey. It looks like this:
Is there possibility to jump to them?
0
votes
2
answers
583
views
Ternjs plugin is not working as expected
I installed ternjs_for_vim plugin but can't figure out how to use it properly. RTFM didn't help. What I get is list random JS-methods in the omni-completion. But things like completing for Node.JS ...
3
votes
1
answer
1k
views
How can I get syntax highlighting to support multiline JavaScript strings?
Currently I have JavaScript (.js) files that contain multiline strings. Vim's syntax highlighting does not seem to support these, as seen in the image below:
Anything below the first line is not ...
4
votes
1
answer
761
views
How can I specify a command-line command with options as an equalprg?
I am trying to set up the Node.js version of js-beautify as an equalprg command when I am editing a JavaScript file, so that the Vim = indent commands reflow my JavaScript at the same time.
Initially,...