diff options
author | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-11-07 20:16:53 -0800 |
---|---|---|
committer | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-11-07 20:16:53 -0800 |
commit | 35f1aad99c4d03217bcc80a2e16efe3ba74379a4 (patch) | |
tree | b42cdc6854db4b34ae592a064a3941f79491e9a3 /lua | |
parent | Disable strict index checking. (diff) | |
parent | Implement ColorizerToggle command (diff) |
Merge branch 'master' of github.com:norcalli/nvim-colorizer.lua
Diffstat (limited to 'lua')
-rw-r--r-- | lua/colorizer.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lua/colorizer.lua b/lua/colorizer.lua index 6f4948f..e47e079 100644 --- a/lua/colorizer.lua +++ b/lua/colorizer.lua @@ -489,6 +489,16 @@ local function new_buffer_options(buf) return FILETYPE_OPTIONS[filetype] or SETUP_SETTINGS.default_options end +--- Check if attached to a buffer. +-- @tparam[opt=0|nil] integer buf A value of 0 implies the current buffer. +-- @return true if attached to the buffer, false otherwise. +local function is_buffer_attached(buf) + if buf == 0 or buf == nil then + buf = nvim_get_current_buf() + end + return BUFFER_OPTIONS[buf] ~= nil +end + --- Attach to a buffer and continuously highlight changes. -- @tparam[opt=0|nil] integer buf A value of 0 implies the current buffer. -- @param[opt] options Configuration options as described in `setup` @@ -627,6 +637,7 @@ end return { DEFAULT_NAMESPACE = DEFAULT_NAMESPACE; setup = setup; + is_buffer_attached = is_buffer_attached; attach_to_buffer = attach_to_buffer; detach_from_buffer = detach_from_buffer; highlight_buffer = highlight_buffer; |