aboutsummaryrefslogtreecommitdiff
path: root/plugin/colorizer.lua
blob: 979a888a8229ae9fdeeb9b1e58daa785b97d723a (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
29
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, {})

-- Stop highlighting the current buffer (detach).
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