-- vim:fdm=marker pcall(require, "impatient") pcall(require, "plugins") pcall(require, "lsp") -- true colors vim.o.termguicolors = true -- map leader to space vim.g.mapleader = " " vim.o.cmdheight = 0 -- line numbers vim.o.mouse = "" vim.o.number = true vim.o.relativenumber = true -- scroll offsets vim.o.scrolloff = 5 vim.o.sidescrolloff = 15 -- show leading/trailing whitespace vim.o.list = true -- always show status & tab line vim.o.laststatus = 3 vim.o.showtabline = 2 -- completion height vim.o.pumheight = 15 -- split directions vim.o.splitbelow = true vim.o.splitright = true vim.o.wrap = false -- redefine word boundaries - '_' is a word seperator, this helps with snake_case vim.opt.iskeyword:remove("_") function Map(mode, shortcut, command, opt) opt = opt or { noremap = true, silent = true } vim.keymap.set(mode, shortcut, command, opt) end -- easier split navigation Map("n", "", "j") Map("n", "", "k") Map("n", "", "l") Map("n", "", "h") Map("n", "\\", ":vsplit") Map("n", "-", ":split") Map("n", "x", ":q") -- merge conflicts Map("n", "gd", ":Gvdiff!") Map("n", "gdh", ":diffget //2") Map("n", "gdl", ":diffget //3") -- clipboard Map("n", "p", '"+p') Map("n", "y", '"+y') -- escape :terminal easier vim.cmd([[tnoremap ]]) -- indentations settings vim.o.shiftwidth = 2 vim.o.tabstop = 2 vim.o.softtabstop = 0 vim.o.expandtab = true vim.cmd([[ autocmd FileType html,lua,css,js,jsreact,ts,tsreact,json,yaml setlocal ts=2 sw=2 sts=0 et autocmd FileType go setlocal ts=4 sw=4 sts=4 noet autocmd FileType python,rust setlocal ts=4 sw=4 sts=4 et autocmd FileType markdown let g:table_mode_corner='|' ]]) vim.api.nvim_create_autocmd("VimResized", { pattern = "*", command = "wincmd =", desc = "Automatically resize windows when the host window size changes.", }) vim.api.nvim_create_autocmd("TextYankPost", { pattern = "*", callback = function() vim.highlight.on_yank({ higroup = "IncSearch", timeout = 200 }) end, desc = "Highlight yanked text", })