First version
This commit is contained in:
23
lua/user/cursor.lua
Normal file
23
lua/user/cursor.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
-- Terminal cursor shapes (Vim t_SI / t_EI / t_SR). Many Neovim builds no longer define these; pcall skips safely.
|
||||
|
||||
local esc = '\27'
|
||||
|
||||
local function set_termcap(name, value)
|
||||
pcall(function()
|
||||
vim.o[name] = value
|
||||
end)
|
||||
end
|
||||
|
||||
if vim.env.TMUX then
|
||||
set_termcap('t_SI', esc .. 'Ptmux;' .. esc .. esc .. '[6 q' .. esc .. '\\')
|
||||
set_termcap('t_EI', esc .. 'Ptmux;' .. esc .. esc .. '[2 q' .. esc .. '\\')
|
||||
else
|
||||
set_termcap('t_SI', esc .. '[6 q') -- insert: bar
|
||||
set_termcap('t_EI', esc .. '[2 q') -- normal: block
|
||||
end
|
||||
|
||||
set_termcap('t_SR', esc .. '[4 q') -- replace: underline
|
||||
|
||||
-- Modern Neovim uses guicursor for mode shapes (also in many terminals/UIs).
|
||||
-- Keep operator-pending block so d/c don't look like replace mode.
|
||||
vim.opt.guicursor = 'n-v-c-sm:block,i-ci-ve:ver25,r-cr:hor20,o:block'
|
||||
Reference in New Issue
Block a user