Skip to content

Instantly share code, notes, and snippets.

@NadOby
Last active March 12, 2023 18:37
Show Gist options
  • Save NadOby/ec5e0b553878b5f23dddb10832cd3f5c to your computer and use it in GitHub Desktop.
Save NadOby/ec5e0b553878b5f23dddb10832cd3f5c to your computer and use it in GitHub Desktop.
Howto configure Svelte 3 Editing under NeoVim

SvelteJS from absolute zero to editing it in (Neo)Vim

Assuming that we don't have nothing related to JavaScript installed or configured.

Based on https://www.rockyourcode.com/vim-and-svelte-js

Installation of Node.js using NVM

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install node

Installation of linters and prettifiers

npm install -g npx eslint prettier eslint-config-prettier eslint-plugin-prettier svelte eslint-plugin-svelte3

first step with Svelte

npx degit sveltejs/template svelte-test
cd svelte-test/
eslint --init
vim .eslintrc.js

Fix it according to https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/README.md#installation

(Neo)Vim congifuration

Add plugins for linting, highliting and prettifing to vimrc this example using Plug

Plug 'pangloss/vim-javascript'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'w0rp/ale'
Plug 'burner/vim-svelte'

Congigure ALE to use check html and css before javascript

let g:ale_linter_aliases = {'svelte': ['css', 'javascript']}
let g:ale_linters = {'svelte': ['stylelint', 'eslint']}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment