diff options
Diffstat (limited to 'plugin/colorizer.lua')
-rw-r--r-- | plugin/colorizer.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/plugin/colorizer.lua b/plugin/colorizer.lua new file mode 100644 index 0000000..1e7ea61 --- /dev/null +++ b/plugin/colorizer.lua @@ -0,0 +1,28 @@ +if vim.g.loaded_colorizer then + return +end + +local command = vim.api.nvim_create_user_command + +command("ColorizerAttachToBuffer", function() + require("colorizer").attach_to_buffer(0) +end, {}) + +command("ColorizerDetachFromBuffer", function() + require("colorizer").detach_from_buffer(0) +end, {}) + +command("ColorizerReloadAllBuffers", function() + require("colorizer").reload_all_buffers() +end, {}) + +command("ColorizerToggle", function() + local c = require "colorizer" + if c.is_buffer_attached(0) then + c.detach_from_buffer(0) + else + c.attach_to_buffer(0) + end +end, {}) + +vim.g.loaded_colorizer = true |