Add nvim config

This commit is contained in:
Thraix
2026-05-18 23:18:07 +02:00
commit e18df83174
19 changed files with 1499 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
local helper = {}
function helper.find_conflict()
vim.cmd("normal! /^<<<<<<<\r")
end
function helper.resolve_top()
vim.cmd("normal! /^<<<<<<<\rdd/^=======\rd/^>>>>>>>\rdd")
end
function helper.resolve_bottom()
vim.cmd("normal! /^<<<<<<<\rd/^=======\rdd/^>>>>>>>\rdd")
end
function helper.resolve_both()
vim.cmd("normal! /^<<<<<<<\rdd/^=======\rdd/^>>>>>>>\rdd")
end
return helper
+28
View File
@@ -0,0 +1,28 @@
local helper = require("core.helper")
local opts = { noremap = true, silent = true }
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.keymap.set("n", "n", "nzzzv", opts)
vim.keymap.set("n", "N", "Nzzzv", opts)
vim.keymap.set("n", "<S-j>", "<C-d>zz", opts)
vim.keymap.set("n", "<S-k>", "<C-u>zz", opts)
vim.keymap.set("v", "<S-j>", "<C-d>zz", opts)
vim.keymap.set("v", "<S-k>", "<C-u>zz", opts)
-- vim.keymap.set('n', '<Tab>', '<cmd> bn <CR>', opts)
-- vim.keymap.set('n', '<S-Tab>', '<cmd> bp <CR>', opts)
-- vim.keymap.set('n', '<C-l>', '<cmd> tabn <CR>', opts)
-- vim.keymap.set('n', '<C-h>', '<cmd> tabp <CR>', opts)
vim.keymap.set("n", "<C-q>", "<cmd> Bd! <CR>", opts)
vim.keymap.set("n", "<leader>lw", "<cmd> set wrap! <CR>", opts)
vim.keymap.set("v", ">", ">gv", opts)
vim.keymap.set("v", "<", "<gv", opts)
vim.keymap.set("v", "p", '"_dP', opts)
vim.keymap.set("t", "<Leader><ESC>", "<C-\\><C-n>", opts)
vim.keymap.set("n", "gl", helper.find_conflict, { desc = "Find next conflict" })
vim.keymap.set("n", "[a", helper.resolve_both, { desc = "Keep both sides" })
vim.keymap.set("n", "[t", helper.resolve_top, { desc = "Keep top" })
vim.keymap.set("n", "[b", helper.resolve_bottom, { desc = "Keep bottom" })
+31
View File
@@ -0,0 +1,31 @@
vim.wo.number = true
vim.o.relativenumber = true
vim.o.clipboard = "unnamedplus"
vim.o.wrap = false
vim.o.linebreak = true
vim.o.mouse = "a"
vim.o.autoindent = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.shiftwidth = 2
vim.o.tabstop = 2
vim.o.softtabstop = 2
vim.o.expandtab = true
vim.o.cursorline = true
vim.o.smartindent = true
vim.o.showtabline = 2
vim.o.conceallevel = 0
vim.o.undofile = true
-- vim.o.colorcolumn = 120
-- Make neovim remember the last location the file was opened in
vim.api.nvim_create_autocmd("BufReadPost", {
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,
})