aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorAshkan Kiani <ashkan.k.kiani@gmail.com>2019-10-18 09:56:49 -0700
committerGitHub <noreply@github.com>2019-10-18 09:56:49 -0700
commitf661199197cc1346124b0b12e77f25150c50a776 (patch)
treeec4f9429458b4e13048c1f755e46509434554441 /lua
parentUpdate docs and luadocs (diff)
Allow excluding files from highlight with '*' (#11)
Fixes GH-5
Diffstat (limited to 'lua')
-rw-r--r--lua/colorizer.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/lua/colorizer.lua b/lua/colorizer.lua
index b869897..32717e5 100644
--- a/lua/colorizer.lua
+++ b/lua/colorizer.lua
@@ -292,6 +292,9 @@ local function setup(filetypes, default_options)
default_options = SETUP_SETTINGS.default_options
function COLORIZER_SETUP_HOOK()
local filetype = nvim.bo.filetype
+ if SETUP_SETTINGS.exclusions[filetype] then
+ return
+ end
local options = FILETYPE_OPTIONS[filetype] or SETUP_SETTINGS.default_options
attach_to_buffer(nvim_get_current_buf(), options)
end
@@ -315,9 +318,14 @@ local function setup(filetypes, default_options)
else
filetype = v
end
- FILETYPE_OPTIONS[filetype] = options
- -- TODO What's the right mode for this? BufEnter?
- nvim.ex.autocmd("FileType", filetype, "lua COLORIZER_SETUP_HOOK()")
+ -- Exclude
+ if filetype:sub(1,1) == '!' then
+ SETUP_SETTINGS.exclusions[filetype:sub(2)] = true
+ else
+ FILETYPE_OPTIONS[filetype] = options
+ -- TODO What's the right mode for this? BufEnter?
+ nvim.ex.autocmd("FileType", filetype, "lua COLORIZER_SETUP_HOOK()")
+ end
end
end
nvim.ex.augroup("END")