edmorrish / vim-svelte

Syntax Highlight for Vue.js components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vim-svelte

Vim syntax highlighting for Svelte components.

This was forked from posva/vim-vue. Most of this is just s/vue/svelte/g.

Installation

Install with Vundle

Plugin 'edmorrish/vim-svelte'

Install with Pathogen

cd ~/.vim/bundle && \
git clone https://github.com/edmorrish/vim-svelte.git

Install without a plugin manager (Vim 8)

git clone https://github.com/edmorrish/vim-svelte.git ~/.vim/pack/plugins/start/vim-svelte

Integration with Syntastic or ALE

I haven't tested the eslint integration at all, but the vue version worked so this might... Currently only eslint is available. Please make sure eslint and eslint-plugin-svelte are installed and properly configured:

npm i -g eslint eslint-plugin-svelte3

Contributing

If your language is not getting highlighted open an issue or a PR with the fix. You only need to add a line to the syntax/svelte.vim file.

Don't forget to write Vader tests for the code you write. You can run the tests by executing make test in the terminal.

FAQ

Where is Jade?

Jade has been renamed to pug. Therefore you have to replace all your jade occurrences with pug. The new plugin for pug can be found on the same repository (the name has already been updated).

My syntax highlighting stops working randomly

This is because Vim tries to highlight text in an efficient way. Especially in files that include multiple languages, it can get confused. To work around this, you can run :syntax sync fromstart when it happens.

You can also setup an autocmd for this, so that every time a Vue file is opened, :syntax sync fromstart will be executed pre-emptively:

autocmd FileType svelte syntax sync fromstart

See :h :syn-sync-first and this article for more details.

How to use commenting functionality with multiple languages in Vue files?

caw.vim features built-in support for file context through context_filetype.vim. Just install both plugins and context-aware commenting will work in most files. The fenced code is detected by predefined regular expressions.

Vim slows down when using this plugin How can I fix that?

Add let g:svelte_disable_pre_processors=1 in your .vimrc to disable checking for prepocessors. When checking for preprocessor languages, multiple syntax highlighting checks are done, which can slow down vim. This variable prevents vim-svelte from supporting every pre-processor language highlighting.

About

Syntax Highlight for Vue.js components

License:MIT License


Languages

Language:Vim Script 87.6%Language:Makefile 11.6%Language:Dockerfile 0.8%