From ea73642a3c82b5e58f6f7f42878bc695e7189efe Mon Sep 17 00:00:00 2001 From: Nate Cox Date: Wed, 13 May 2026 11:25:07 -0700 Subject: Initial commit --- .config/nvim/init.lua | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .config/nvim/init.lua (limited to '.config/nvim/init.lua') diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..9388c7f --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,107 @@ +-- Setup defaults +vim.g.mapleader = " " +vim.g.maplocalleader = " " +vim.g.have_nerd_font = true + +vim.o.number = true +vim.o.relativenumber = true +vim.o.ignorecase = true +vim.o.smartcase = true +vim.o.scrolloff = 10 +vim.o.confirm = true + +-- Use tabs, display as two spaces +vim.o.expandtab = false +vim.o.tabstop = 2 +vim.o.softtabstop = 2 +vim.o.shiftwidth = 0 + +vim.o.complete = ".,o" -- use buffer and omnifunc +vim.o.completeopt = "fuzzy,menuone,noselect" -- add 'popup' for docs (sometimes) +vim.o.autocomplete = true +vim.o.pumheight = 7 + +-- Plugin configuration +vim.pack.add({ + "https://github.com/nvim-lua/plenary.nvim", + "https://github.com/nvim-telescope/telescope.nvim", + "https://github.com/NeogitOrg/neogit", + "https://github.com/neovim/nvim-lspconfig", + -- 'https://github.com/rose-pine/neovim', + "https://github.com/RRethy/base16-nvim", + "https://github.com/stevearc/conform.nvim", +}) + +require("matugen").setup() + +local telescope = require("telescope") +telescope.setup({ + defaults = { + sorting_strategy = "ascending", + layout_config = { + prompt_position = "top", + }, + }, + pickers = { + find_files = { + hidden = true, + }, + }, +}) + +local builtin = require("telescope.builtin") +vim.keymap.set("n", "ff", builtin.find_files, { desc = "Telescope find files" }) +vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Telescope live grep" }) +vim.keymap.set("n", "fb", builtin.buffers, { desc = "Telescope buffers" }) +vim.keymap.set("n", "fh", builtin.help_tags, { desc = "Telescope help tags" }) +vim.keymap.set("n", "fd", builtin.diagnostics, { desc = "Telescope diagnostics" }) + +vim.cmd("packadd nvim.undotree") +vim.keymap.set("n", "u", require("undotree").open) + +local neogit = require("neogit") +neogit.setup({ + graph_style = "unicode", +}) + +vim.keymap.set("n", "gg", function() + neogit.open({ kind = "split" }) +end, { desc = "Open Neogit UI" }) + +local rocks_config = { + rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks", +} + +vim.g.rocks_nvim = rocks_config + +local luarocks_path = { + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"), + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"), +} +package.path = package.path .. ";" .. table.concat(luarocks_path, ";") + +local luarocks_cpath = { + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"), + -- Remove the dylib and dll paths if you do not need macos or windows support + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dylib"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dylib"), + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dll"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dll"), +} +package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";") + +vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, "lib", "luarocks", "rocks-5.1", "rocks.nvim", "*")) + +vim.lsp.enable("rust_analyzer") + +require("conform").setup({ + format_on_save = { + timeout_ms = 500, + lsp_format = "fallback", + }, + formatters_by_ft = { + lua = { "stylua" }, + rust = { "rustfmt", lsp_format = "fallback" }, + }, +}) -- cgit v1.3.1