style(init.lua): improve formatting and indentation for better readability

feat(init.lua): add functionality to change cursor color based on different modes for better user experience
This commit is contained in:
David Ibia
2024-03-13 03:54:08 +01:00
parent bbda0a7757
commit a36964cd5c

View File

@@ -1,5 +1,3 @@
-- vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
@@ -32,3 +30,29 @@ vim.opt.colorcolumn = ""
vim.g.mapleader = " "
vim.g.maplocalleader = ";"
vim.opt.guicursor = "n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,"
.. "a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,"
.. "sm:block-blinkwait175-blinkoff150-blinkon175"
-- Function to change cursor color
local function set_cursor_color(color)
vim.api.nvim_set_hl(0, "Cursor", { fg = color, bg = color })
end
-- Autocommands to change cursor color based on mode
vim.api.nvim_create_autocmd("InsertEnter", {
pattern = "*",
callback = function()
set_cursor_color("#ffffff") -- Red in insert mode
end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
pattern = "*",
callback = function()
set_cursor_color("#7DF9FF") -- Blue in visual mode
end,
})
-- Add similar autocommands for other modes as needed