feat: new option virtcolumn_priority

This commit is contained in:
wongxy
2022-07-12 21:34:35 +08:00
parent e23c9aa851
commit 0376fe6725
2 changed files with 8 additions and 4 deletions
+3 -2
View File
@@ -19,10 +19,11 @@ Same as other normal plugins, use your favourite plugin manager to install.
This plugin is aiming for zero configuration, you just need to install and make
sure this plugin loaded and it will automatically handle `colorcolumn`
### char
by default
```lua
vim.g.virtcolumn_char = '' -- by default
vim.g.virtcolumn_char = '' -- char to display the line
vim.g.virtcolumn_priority = 10 -- priority of extmark
```
### highlight
+5 -2
View File
@@ -1,4 +1,6 @@
--- vim.g.virtcolumn_char: ▕ by default
--- Options:
--- vim.g.virtcolumn_char = "▕"
--- vim.g.virtcolumn_priority = 10
local api = vim.api
local ffi = require "ffi"
@@ -76,6 +78,7 @@ local function _refresh()
local lines = api.nvim_buf_get_lines(curbuf, offset, vim.fn.line "w$" + debounce, false)
local tabstop = vim.opt.tabstop:get()
local char = vim.g.virtcolumn_char or ""
local priority = vim.g.virtcolumn_priority or 10
for i = 1, #lines do
for _, item in ipairs(items) do
@@ -86,7 +89,7 @@ local function _refresh()
virt_text_pos = "overlay",
hl_mode = "combine",
virt_text_win_col = item - 1,
priority = 0,
priority = priority,
})
end
end