Files
nvim/init.lua
hgranthorner 0485e97fd2 initial commit
2026-09-14 16:09:15 -04:00

132 lines
3.4 KiB
Lua

vim.opt.swapfile = false
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.opt.expandtab = true -- Convert tabs to spaces
vim.opt.tabstop = 4 -- Number of spaces per tab
vim.opt.shiftwidth = 4 -- Spaces used for autoindent
vim.opt.softtabstop = 4 -- Spaces inserted when pressing Tab
vim.o.number = true
vim.o.mouse = "a"
vim.o.showmode = false
vim.schedule(function()
vim.o.clipboard = "unnamedplus"
end)
vim.o.breakindent = true
vim.o.undofile = true
vim.o.ignorecase = true
vim.o.smartcase = true
-- Adds extra space for git diff symbols and stuff
vim.o.signcolumn = "yes"
-- Decrease update time
vim.o.updatetime = 250
-- Decrease mapped sequence wait time
vim.o.timeoutlen = 300
-- Configure how new splits should be opened
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.list = false
-- vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
-- Preview substitutions live, as you type!
vim.o.inccommand = "split"
-- Show which line your cursor is on
vim.o.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.o.scrolloff = 3
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
vim.o.confirm = true
-- Neovim 0.12+ improvements
vim.o.winborder = "rounded"
vim.o.pumborder = "rounded"
vim.opt.completeopt:append("fuzzy")
-- vim.o.autocomplete = true
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.hl.hl_op()
end,
})
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
-- Diagnostic Config & Keymaps
-- See :help vim.diagnostic.Opts
vim.diagnostic.config({
update_in_insert = false,
severity_sort = true,
float = { source = "if_many" },
underline = { severity = { min = vim.diagnostic.severity.WARN } },
-- Can switch between these as you prefer
virtual_text = true, -- Text shows up at the end of the line
virtual_lines = false, -- Text shows up underneath the line, with virtual lines
-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
jump = {
on_jump = function(_, bufnr)
-- Open diagnostic float when you jump
vim.diagnostic.open_float({ bufnr = bufnr, scope = "cursor", focus = false })
end,
},
})
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
vim.keymap.set("n", "<leader>so", "<CMD>so<CR>")
vim.keymap.set("n", "<leader>ei", function()
vim.cmd([[edit $MYVIMRC]])
end)
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
vim.pack.add({
"https://github.com/tjdevries/colorbuddy.nvim",
"https://github.com/hgranthorner/ghosttybuddy.nvim",
})
vim.cmd.colorscheme("ghostty")
local nmap_leader = function(suffix, rhs, desc)
vim.keymap.set("n", "<Leader>" .. suffix, rhs, { desc = desc })
end
nmap_leader("fs", function()
vim.cmd([[write]])
end, "Save")
local function add_mcursor_to_selection()
vim.cmd([[normal! Q *]])
vim.cmd.nohl()
vim.cmd([[normal! 1q=]])
end
vim.keymap.set({ "n", "v" }, "<C-g>", add_mcursor_to_selection)
require("plugins.mini")
require("plugins.oil")
require("plugins.fugitive")
require("plugins.conform")
require("settings.lsp")