set "syntax sync fromstart" by default

Instead of setting it by default, I initially only added this as a tip
to the readme, because it is said to be slower. However, I don't really
notice a performance difference, and when the highlighting isn't working
reliably without it, I think it's better to just include it by default.
This commit is contained in:
Adriaan Zonnenberg
2019-08-03 21:01:05 +02:00
parent fcdc2d25d1
commit c424294e76
2 changed files with 2 additions and 16 deletions

View File

@@ -58,22 +58,6 @@ Therefore you have to replace all your `jade` occurrences with `pug`. The new
plugin for `pug` can be found on [the same repository](https://github.com/digitaltoad/vim-pug)
(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:
```vim
autocmd FileType vue syntax sync fromstart
```
See `:h :syn-sync-first` and [this article](http://vim.wikia.com/wiki/Fix_syntax_highlighting)
for more details.
### How to use commenting functionality with multiple languages in Vue files?
#### [tcomment](https://github.com/tomtom/tcomment_vim)

View File

@@ -73,4 +73,6 @@ syn keyword htmlSpecialTagName contained template
syn keyword htmlArg contained scoped ts
syn match htmlArg "[@v:][-:.0-9_a-z]*\>" contained
syntax sync fromstart
let b:current_syntax = "vue"