update config to lazy

- add some new plugins
- remove some old ones
- clean up/update some configs
This commit is contained in:
2025-02-16 01:47:35 -08:00
parent f1d8f5f834
commit 9c083c98a3
87 changed files with 2377 additions and 2242 deletions

View File

@@ -1,7 +1,7 @@
local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
-- Restore cursor position
-- {{{ Restore cursor position
local restore_cursor = augroup("RestoreCursor", { clear = true })
autocmd("BufReadPost", {
group = restore_cursor,
@@ -13,23 +13,27 @@ autocmd("BufReadPost", {
end
end,
})
-- }}}
-- Help and man pages in vertical split
-- {{{ Open help and man in vertical split
local help_config = augroup("HelpConfig", { clear = true })
autocmd("FileType", {
group = help_config,
pattern = { "help", "man" },
command = "wincmd L",
})
-- }}}
-- Terminal settings
-- {{{ set term options
local term_config = augroup("TermConfig", { clear = true })
autocmd("TermOpen", {
group = term_config,
pattern = "*",
command = "setlocal nonumber norelativenumber",
})
-- }}}
-- {{{ Highlight yanked text
local highlight_yank = augroup("HighlightYank", { clear = true })
autocmd("TextYankPost", {
group = highlight_yank,
@@ -38,7 +42,9 @@ autocmd("TextYankPost", {
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 420 })
end,
})
-- }}}
-- {{{ Disable indent-blankline for dashboard
function disable_for_dashboard()
local buftype = vim.api.nvim_buf_get_option(0, "buftype")
local filetype = vim.api.nvim_buf_get_option(0, "filetype")
@@ -52,39 +58,19 @@ vim.cmd([[
autocmd FileType dashboard lua disable_for_dashboard()
augroup END
]])
-- }}}
-- Code actions on cursor hold
-- local code_action = augroup('CodeAction', { clear = true })
-- autocmd({ 'CursorHold', 'CursorHoldI' }, {
-- group = code_action,
-- callback = function()
-- if vim.tbl_isempty(vim.lsp.buf_get_clients()) then
-- require('code_action_utils').code_action_listener()
-- end
-- end
-- })
-- {{{ Code companion hook
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
local function set_timeoutlen_for_insert_mode()
if vim.bo.buftype == "terminal" or vim.bo.filetype == "codecompanion" then
vim.o.timeoutlen = 0
else
vim.o.timeoutlen = 300 -- Default timeoutlen for other buffers
end
end
-- Create an augroup for managing the autocmds
local augroup = vim.api.nvim_create_augroup("InsertModeTimeout", { clear = true })
-- Autocommand to adjust timeoutlen when entering insert mode
vim.api.nvim_create_autocmd("InsertEnter", {
group = augroup,
callback = set_timeoutlen_for_insert_mode,
})
-- Autocommand to reset timeoutlen when leaving insert mode
vim.api.nvim_create_autocmd("InsertLeave", {
group = augroup,
callback = function()
vim.o.timeoutlen = 300
vim.api.nvim_create_autocmd({ "User" }, {
pattern = "CodeCompanionInline*",
group = group,
callback = function(request)
if request.match == "CodeCompanionInlineFinished" then
-- Format the buffer after the inline request has completed
require("conform").format({ bufnr = request.buf })
end
end,
})
-- }}}