From 0ce99782536f1fc2071bff221680ffd9a80f6a4d Mon Sep 17 00:00:00 2001 From: Leonardo Date: Sun, 10 Sep 2023 07:05:05 -0300 Subject: [PATCH] feat: use vim.opt.winhighlight:append (#289) So as to not clobber other custom window highlights. Co-authored-by: lbrayner --- lua/dapui/render/line_hover.lua | 4 +++- lua/dapui/windows/layout.lua | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/dapui/render/line_hover.lua b/lua/dapui/render/line_hover.lua index 277a365..905b956 100644 --- a/lua/dapui/render/line_hover.lua +++ b/lua/dapui/render/line_hover.lua @@ -102,7 +102,9 @@ function M.show() window_id = api.nvim_open_win(hover_buf, false, win_opts) buf_wins[buffer] = window_id - api.nvim_win_set_option(window_id, "winhighlight", "NormalFloat:Normal") + api.nvim_win_call(window_id, function() + vim.opt.winhighlight:append({ NormalFloat = "Normal" }) + end) end orig_col = orig_col - 1 -- Working with 0-based index now diff --git a/lua/dapui/windows/layout.lua b/lua/dapui/windows/layout.lua index 4a1fb23..f85ad8e 100644 --- a/lua/dapui/windows/layout.lua +++ b/lua/dapui/windows/layout.lua @@ -184,7 +184,9 @@ function WindowLayout:_init_win_settings(win) for key, val in pairs(win_settings) do api.nvim_win_set_option(win, key, val) end - vim.fn.setwinvar(win, "&winhl", "Normal:DapUINormal,EndOfBuffer:DapUIEndOfBuffer") + api.nvim_win_call(win, function() + vim.opt.winhighlight:append({ Normal = "DapUINormal", EndOfBuffer = "DapUIEndOfBuffer" }) + end) end function WindowLayout:new(layout)