Editing Javascript in vim in Docker

Can neovim + plugins actually functionally beat Visual Studio code?

Published: Sunday, Oct 31, 2021 Last modified: Friday, Dec 3, 2021

I’m spoilt by vim-go, goformat, goimports, a vim IDE that works productively for programming Golang.

Now since I code in Javascript for work, especially for the AWS Cloud Development Kit I want the same features in vim!

The test

UPDATE: This test assumes Javascript, and for proper completion typescript types is more pragmatic.

git clone https://github.com/kaihendry/sam-cdk-app-demo.git

Open lib/aws-sam-cli-cdk-hello-world-stack.js


Add an incorrectly formatted console.log, will it get reformatted on save?


Remove runtime: from the lambda.Function constructor. Is the editor (or integrated language server) smart enough to auto complete / suggest that runtime is mandatory and needs to put back?

Next test: Setup a dynamodb table. Can the editor automatically import “@aws-cdk/aws-dynamodb”?

Dockerized neovim

To reproduce issues with my own setup and others, I’m going to try different neovim configurations with the help of Docker containers.

I wouldn’t realistically edit using Docker because it’s far too slow to startup!!


docker run -it --rm spacevim/spacevim

A whole bunch of text errors on startup. Er next!



console. completion sucks, no autoformatting. Docs are nice though:

Removing runtime, then correctly suggests I need runtime back:

If I save the file without runtime, there is no warning that my program will fail. Tbh VScode doesn’t seem to show my program will fail either missing runtime!

Now adding:

const atable = new dynamodb.Table(this, "hello-world-table", {

I give it 2/5 rating. It’s probably coc-tsserver at fault or probably me.


Seems hinged on neovim 0.4x. Moving on..


First to warn me:

[coc.nvim] No ESLint configuration (e.g .eslintrc) found for file: /app/lib/aws-sam-cli-cdk-hello-world-stack.js

Completion seems useless:

Is CoC even working??


Fails to build:

/bin/sh: pip3: not found


A different sort of python build error!

gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory


Could not get it to open lib/aws-sam-cli-cdk-hello-world-stack.js


mjlbach put me onto his LUA based neovim configuration: https://github.com/nvim-lsp/try.nvim/blob/master/typescript/init.lua

I will probably switch to using https://github.com/nvim-lua/kickstart.nvim without a Docker image.

hrsh7th/nvim-cmp is the Autocompletion plugin, not “nvim-compe” which is deprecated.


UPDATE: Complete rewrite in https://github.com/kaihendry/nvim

This is my project for my own sanity checking with CoC!

Auto complete on console. is sensible:

Docs are OK

But it doesn’t seem to work on CDK. No docs.



I learned two things about editing Javascript with vim.

First, for a experience comparable to the exemplary vim-go you need to ensure you’re actually working with TypeScript Types. This is actually non-trivial for smaller packages where type definitions are contributed by the community.

Neovim departs from vim with its LUA language integration and its inbuilt language server :LspInfo. I think I will give it a try. I encourage you to try too:

docker run --rm -it --entrypoint=sh -v $(pwd):/src quay.io/nvim-lsp/try.nvim:nightly-typescript

That said, don’t get FOMO. Editing vim without this crazy configuration is actually the better place to be!