Skip to content

Commit b15e4c1

Browse files
authored
feat: disable cursor in preview window (#433)
1 parent b0a6cf9 commit b15e4c1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lua/oil/mutator/preview.lua

+8
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ M.show = vim.schedule_wrap(function(actions, should_confirm, cb)
114114

115115
render_lines(winid, bufnr, lines)
116116

117+
-- Disable cursor
118+
-- We are in the preview window now, so no need to use autocmd with WinEnter
119+
vim.api.nvim_set_hl(0, "OilPreviewCursor", { nocombine = true, blend = 100 })
120+
vim.opt.guicursor:append("a:OilPreviewCursor/OilPreviewCursor")
121+
117122
-- Attach autocmds and keymaps
118123
local cancel
119124
local confirm
@@ -127,6 +132,9 @@ M.show = vim.schedule_wrap(function(actions, should_confirm, cb)
127132
end
128133
autocmds = {}
129134
vim.api.nvim_win_close(winid, true)
135+
-- restore cursor
136+
vim.api.nvim_set_hl(0, "OilPreviewCursor", {})
137+
vim.opt.guicursor:remove("a:OilPreviewCursor/OilPreviewCursor")
130138
cb(value)
131139
end
132140
end

0 commit comments

Comments
 (0)