From 50aa05bd7223bf8887c1b66d092c5177c061c812 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 23 Sep 2020 23:49:57 +0200 Subject: Allow to disable only syntax highlighting, #556 --- README.md | 8 +++++++- ftdetect/polyglot.vim | 13 ++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 652c1361..75412436 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,13 @@ The list of available languages to disable is shown above. *Please declare this variable before polyglot is loaded (at the top of .vimrc)* -Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are loaded lazily, on demand. +If you wish to use filetype detection by Vim Polyglot but you'd like to use your own syntax-highlighting plugin, you can append `.plugin` to disabled entry, like so: + +```vim +let g:polyglot_disabled = ['markdown.plugin'] +``` + +Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are lazily loaded only when they are really needed. Vim Polyglot tries to automatically detect indentation settings (just like vim-sleuth). If this feature is not working for you for some reason, please file an issue and disable it temporarily with: diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index ba187f91..f9b6a670 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -8,10 +8,15 @@ if exists('g:polyglot_test') endif let s:disabled_packages = {} +let s:new_polyglot_disabled = [] if exists('g:polyglot_disabled') for pkg in g:polyglot_disabled - let s:disabled_packages[pkg] = 1 + let base = split(pkg, '\.') + if len(base) > 0 + let s:disabled_packages[pkg] = 1 + call add(s:new_polyglot_disabled, base[0]) + endif endfor else let g:polyglot_disabled_not_set = 1 @@ -2227,6 +2232,12 @@ endfunc au BufEnter * if &ft == "" && expand("") !~ g:ft_ignore_pat \ | call s:observe_filetype() | endif + +" Save polyglot_disabled without postfixes +if exists('g:polyglot_disabled') + let g:polyglot_disabled = s:new_polyglot_disabled +endif + " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save -- cgit v1.2.3