Cleanup to neovim and alacritty.

This commit is contained in:
2026-08-06 06:25:49 +02:00
parent 6327828c90
commit e8275c583d
4 changed files with 50 additions and 454 deletions
+20 -22
View File
@@ -1,13 +1,11 @@
require("vim._core.ui2").enable({})
map = vim.keymap.set
vim.o.termguicolors = true
vim.o.showmode = false
vim.o.showmode = true
vim.o.laststatus = 3
vim.o.nu = true
vim.o.swapfile = false
vim.o.winborder = "single"
vim.o.winblend = 0
vim.o.pumblend = 0
vim.o.scrolloff = 20
vim.o.shiftwidth = 4
vim.o.tabstop = 4
@@ -19,19 +17,16 @@ vim.o.hlsearch = true
vim.o.mouse = "a"
vim.o.path = "**"
vim.o.clipboard = "unnamedplus"
vim.o.foldenable = true
vim.o.foldmethod = "expr"
vim.o.foldlevel = 99
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.signcolumn = "yes"
vim.o.completeopt = "menu,menuone,noselect,popup,fuzzy"
vim.o.autoread = true
vim.o.undofile = true
vim.o.undodir = vim.fn.stdpath("state") .. "/undo"
vim.o.errorformat = "%f(%l:%c) %m,%-G%.%#"
-- -----------------------------
-- @BINDS
-- -----------------------------
map("t", "<ESC><ESC>", "<C-\\><C-n>")
map({"t", "n"}, "<C-h>", "<C-\\><C-n><C-w><C-h>")
map({"t", "n"}, "<C-j>", "<C-\\><C-n><C-w><C-j>")
@@ -43,19 +38,16 @@ map("v", "J", ":m '>+1<CR>gv=gv")
map("v", "K", ":m '<-2<CR>gv=gv")
map("v", "<S-Tab>", "<gv")
map("v", "<Tab>" , ">gv")
map("n", "<C-p>", ":find ")
map("n", "<C-e>", ":Lex<CR>")
map("n", "<C-backspace>", ":bd<CR>")
map("i", "<C-h>", vim.lsp.buf.signature_help)
-- -----------------------------
-- @PLUGINS
-- -----------------------------
require("plugins")
require("theme").load()
require("theme").watch()
-- -----------------------------
-- @EXTRAS
require("extra/lsp")
require("extra/terminal")
require("extra/build")
-- -----------------------------
-- @AUTOCMDS
-- -----------------------------
-- Terminals should open with insert mode
vim.api.nvim_create_autocmd({ "BufEnter", "TermEnter", "WinEnter" }, {
pattern = "term://*",
@@ -84,11 +76,17 @@ vim.api.nvim_create_autocmd("BufWritePre", {
vim.fn.setpos(".", save_cursor)
end,
})
vim.api.nvim_create_augroup('AutoResizeWindows', { clear = true })
vim.api.nvim_create_autocmd('VimResized', {
group = 'AutoResizeWindows',
callback = function()
vim.cmd('wincmd =')
end,
-- Restore cursor to file position in previous editing session
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function(args)
local mark = vim.api.nvim_buf_get_mark(args.buf, '"')
local line_count = vim.api.nvim_buf_line_count(args.buf)
if mark[1] > 0 and mark[1] <= line_count then
vim.api.nvim_win_set_cursor(0, mark)
-- defer centering slightly so it's applied after render
vim.schedule(function()
vim.cmd("normal! zz")
end)
end
end,
})