aboutsummaryrefslogtreecommitdiff
path: root/plugin/colorizer.lua
blob: 1e7ea614b6c2105c099e1fe15e6f6544d9168fc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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