mirror of
https://github.com/norcalli/nvim-colorizer.lua.git
synced 2026-09-10 07:06:14 -04:00
Merge branch 'master' of github.com:norcalli/nvim-colorizer.lua
This commit is contained in:
commit
35f1aad99c
34
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
34
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
name: Bug
|
||||
about: Create a bug report
|
||||
title: 'Bug:'
|
||||
labels: bug
|
||||
assignees: norcalli
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Your configuration and/or a small reproducible test, and/or the steps required to reproduce.
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Operating System:**
|
||||
e.g. Ubuntu 16.04
|
||||
|
||||
**Neovim Version:**
|
||||
e.g. 0.4.2
|
||||
|
||||
**Colorizer Version:**
|
||||
Paste the output of
|
||||
|
||||
`find ~/.config/nvim/ -type d -name 'nvim-colorizer.lua' -exec git rev-parse HEAD \;`
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
|
@ -132,6 +132,10 @@ Stop highlighting the current buffer (detach).
|
|||
Reload all buffers that are being highlighted with new settings from the setup
|
||||
settings (or the defaults). Shortcut for ColorizerAttachToBuffer on every
|
||||
buffer.
|
||||
|
||||
|:ColorizerToggle|
|
||||
|
||||
Toggle highlighting of the current buffer.
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ Reload all buffers that are being highlighted with new settings from the setup
|
|||
settings (or the defaults). Shortcut for ColorizerAttachToBuffer on every
|
||||
buffer.
|
||||
|
||||
:ColorizerToggle :ColorizerToggle
|
||||
|
||||
Toggle highlighting of the current buffer.
|
||||
|
||||
==============================================================================
|
||||
LUA API DEFINITION *colorizer-lua-api*
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -5,5 +5,8 @@ endif
|
|||
command! ColorizerAttachToBuffer lua require'colorizer'.attach_to_buffer(0)
|
||||
command! ColorizerDetachFromBuffer lua require'colorizer'.detach_from_buffer(0)
|
||||
command! ColorizerReloadAllBuffers lua require'colorizer'.reload_all_buffers()
|
||||
command! ColorizerToggle lua local c = require'colorizer'
|
||||
\ if c.is_buffer_attached(0) then c.detach_from_buffer(0) else
|
||||
\ c.attach_to_buffer(0) end
|
||||
|
||||
let g:loaded_colorizer = 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue