nvim-tree/nvim-tree.lua

hide the cursor in nvim-tree buffer

Opened this issue · 3 comments

Discussed in #3191

Originally posted by vivitekk August 18, 2025
is it possible to add a new setup option to hide the cursor in nvim-tree buffer?

ftplugin/NvimTree.lua:

local write = api.nvim_ui_send or function(s) return io.stdout:write(s) end
local hide = function() write('\027[?25l') end
local show = function() write('\027[?25h') end
api.nvim_create_autocmd('BufEnter', { buffer = 0, callback = hide })
api.nvim_create_autocmd('BufLeave', { buffer = 0, callback = show })
api.nvim_create_autocmd('CmdLineEnter', { buffer = 0, callback = show })
api.nvim_create_autocmd('CmdLineLeave', { buffer = 0, callback = hide })

another way is to toggle hlgroup in &guicursor. Both is dangerous since cursor is always handle globally.

ftplugin/NvimTree.lua:

Nice find. Yes, they are both very dangerous.

+1 on this