Initial neovim config

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>
This commit is contained in:
Mikhail Kilin
2026-02-23 23:40:37 +03:00
commit 7213bec4dc
16 changed files with 478 additions and 0 deletions

35
lua/config/autocmds.lua Normal file
View File

@@ -0,0 +1,35 @@
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 =",
})