Implement 'winhl' user option

This commit is contained in:
edluffy 2021-03-23 23:31:18 +00:00
parent 5a6c375b80
commit ba3471c804
2 changed files with 9 additions and 0 deletions

View file

@ -2,6 +2,10 @@
Show where your cursor moves when jumping large distances (e.g between windows). Fast and lightweight, written completely in Lua. WIP. Show where your cursor moves when jumping large distances (e.g between windows). Fast and lightweight, written completely in Lua. WIP.
![demo](https://user-images.githubusercontent.com/28115337/111098526-90923e00-853b-11eb-8e7c-c5892d64c180.gif) ![demo](https://user-images.githubusercontent.com/28115337/111098526-90923e00-853b-11eb-8e7c-c5892d64c180.gif)
New: added option for custom highlighting for popup:
![demo2](https://user-images.githubusercontent.com/28115337/112231882-7b01d000-8c2f-11eb-9f06-e6e6e492a533.gif)
## Install ## Install
Using [packer.nvim](https://github.com/wbthomason/packer.nvim): Using [packer.nvim](https://github.com/wbthomason/packer.nvim):
```lua ```lua
@ -22,6 +26,7 @@ require('specs').setup{
inc_ms = 10, inc_ms = 10,
blend = 10, blend = 10,
width = 10, width = 10,
winhl = "PMenu",
fader = require('specs').linear_fader, fader = require('specs').linear_fader,
resizer = require('specs').shrink_resizer resizer = require('specs').shrink_resizer
} }

View file

@ -26,8 +26,11 @@ function M.show_specs()
row = cursor_row, row = cursor_row,
style = 'minimal' style = 'minimal'
}) })
vim.api.nvim_win_set_option(win_id, 'winhl', 'Normal:'.. opts.popup.winhl)
vim.api.nvim_win_set_option(win_id, "winblend", opts.popup.blend) vim.api.nvim_win_set_option(win_id, "winblend", opts.popup.blend)
local cnt = 0 local cnt = 0
local config = vim.api.nvim_win_get_config(win_id) local config = vim.api.nvim_win_get_config(win_id)
local timer = vim.loop.new_timer() local timer = vim.loop.new_timer()
@ -123,6 +126,7 @@ local DEFAULT_OPTS = {
inc_ms = 5, inc_ms = 5,
blend = 10, blend = 10,
width = 20, width = 20,
winhl = "PMenu",
fader = M.exp_fader, fader = M.exp_fader,
resizer = M.shrink_resizer resizer = M.shrink_resizer
} }