Skip to content

Commit

Permalink
feat: add config options for setting winhighlight (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Dec 19, 2021
1 parent 4b677be commit c856074
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lua/dressing/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ local default_config = {

-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",

-- see :help dressing_get_config
get_config = nil,
Expand Down Expand Up @@ -65,6 +67,8 @@ local default_config = {

-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",

-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
width = nil,
Expand Down
1 change: 1 addition & 0 deletions lua/dressing/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ setmetatable(M, {
opts = opts,
}
vim.api.nvim_win_set_option(winid, "winblend", config.winblend)
vim.api.nvim_win_set_option(winid, "winhighlight", config.winhighlight)

-- Finish setting up the buffer
vim.api.nvim_buf_set_option(bufnr, "swapfile", false)
Expand Down
1 change: 1 addition & 0 deletions lua/dressing/select/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ M.select = function(config, items, opts, on_choice)
}
local winnr = vim.api.nvim_open_win(bufnr, true, winopt)
vim.api.nvim_win_set_option(winnr, "winblend", config.winblend)
vim.api.nvim_win_set_option(winnr, "winhighlight", config.winhighlight)
vim.api.nvim_win_set_option(winnr, "cursorline", true)
pcall(vim.api.nvim_win_set_option, winnr, "cursorlineopt", "both")
vim.api.nvim_buf_set_option(bufnr, "filetype", "DressingSelect")
Expand Down
4 changes: 2 additions & 2 deletions plugin/dressing.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require("dressing").patch()
vim.cmd([[highlight default link FloatTitle FloatBorder]])
vim.cmd([[highlight default link DressingSelectText Normal]])
vim.cmd([[highlight default link DressingInputText Normal]])
vim.cmd([[highlight default link DressingSelectText NormalFloat]])
vim.cmd([[highlight default link DressingInputText NormalFloat]])

0 comments on commit c856074

Please sign in to comment.