Lazy.nvim plugin manager, LSP (rust-analyzer, clangd, ts_ls, zls), treesitter, telescope, bufferline, neo-tree, gitsigns, lazygit, alabaster theme, persistence sessions, nvim-cmp, lualine, which-key. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
935 B
Lua
36 lines
935 B
Lua
local augroup = vim.api.nvim_create_augroup
|
|
local autocmd = vim.api.nvim_create_autocmd
|
|
|
|
-- Highlight on yank
|
|
autocmd("TextYankPost", {
|
|
group = augroup("highlight_yank", { clear = true }),
|
|
callback = function()
|
|
vim.highlight.on_yank({ timeout = 200 })
|
|
end,
|
|
})
|
|
|
|
-- Remove trailing whitespace on save
|
|
autocmd("BufWritePre", {
|
|
group = augroup("trim_whitespace", { clear = true }),
|
|
pattern = "*",
|
|
command = "%s/\\s\\+$//e",
|
|
})
|
|
|
|
-- Restore cursor position
|
|
autocmd("BufReadPost", {
|
|
group = augroup("restore_cursor", { clear = true }),
|
|
callback = function()
|
|
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
|
local lcount = vim.api.nvim_buf_line_count(0)
|
|
if mark[1] > 0 and mark[1] <= lcount then
|
|
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
|
end
|
|
end,
|
|
})
|
|
|
|
-- Auto-resize splits on window resize
|
|
autocmd("VimResized", {
|
|
group = augroup("auto_resize", { clear = true }),
|
|
command = "tabdo wincmd =",
|
|
})
|