From f4258f2fb0e5b78dd76bba6ada90b9cf16743847 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:58:19 +0200 Subject: [PATCH] tree(hl): hide gui cursor, only use cursorline for indicating node position in tree --- lua/nxvim/plugins/neo-tree.lua | 1 + lua/nxvim/plugins/noice.lua | 28 ++++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lua/nxvim/plugins/neo-tree.lua b/lua/nxvim/plugins/neo-tree.lua index ae0585c..5647ba4 100644 --- a/lua/nxvim/plugins/neo-tree.lua +++ b/lua/nxvim/plugins/neo-tree.lua @@ -330,6 +330,7 @@ nx.au({ pattern = "neo-tree-popup", callback = function() vim.schedule(function() + vim.cmd("set gcr=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20") nx.map({ -- Allow to escape into normal mode in fuzzy finder input popup. { "", "", "i" }, diff --git a/lua/nxvim/plugins/noice.lua b/lua/nxvim/plugins/noice.lua index 720bb7f..eca345e 100644 --- a/lua/nxvim/plugins/noice.lua +++ b/lua/nxvim/plugins/noice.lua @@ -48,10 +48,25 @@ require("noice").setup({ -- ] --- [ == Highlights ============================================================ +-- [ == Events ================================================================ -nx.hl({ { "NoiceCmdlinePopupBorder", "NoiceCmdlineIconCmdLine" }, link = "Operator" }) --- <== ] +local hacks = require("noice.util.hacks") + +nx.au({ + { "WinEnter", "FocusGained" }, + callback = function(ev) + -- if vim.bo[ev.buf].filetype ~= "neo-tree" then vim.cmd("set gcr=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20") end + if not ev.buf then return end + if vim.bo[ev.buf].filetype == "neo-tree" then + hacks.hide_cursor() + else + -- hacks.show_cursor() + vim.cmd("set gcr=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20") + end + end, +}) + +-- ] -- [ == Keymaps =============================================================== @@ -59,4 +74,9 @@ nx.map({ { "", "", "c", desc = "Next Entry" }, { "", "", "c", desc = "Previous Entry" }, }) --- <== } +-- ] + +-- [ == Highlights ============================================================ + +nx.hl({ { "NoiceCmdlinePopupBorder", "NoiceCmdlineIconCmdLine" }, link = "Operator" }) +-- ]