summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorNate Cox <nate@natecox.dev>2026-05-13 11:25:07 -0700
committerNate Cox <nate@natecox.dev>2026-05-13 11:25:07 -0700
commitea73642a3c82b5e58f6f7f42878bc695e7189efe (patch)
tree96ec63b2995d15c8972a2c7d4be9a7c4089b62b6 /.config/nvim
downloaddotfiles-ea73642a3c82b5e58f6f7f42878bc695e7189efe.tar.bz2
dotfiles-ea73642a3c82b5e58f6f7f42878bc695e7189efe.zip
Initial commit
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua107
1 files changed, 107 insertions, 0 deletions
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", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
+vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Telescope live grep" })
+vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope buffers" })
+vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Telescope help tags" })
+vim.keymap.set("n", "<leader>fd", builtin.diagnostics, { desc = "Telescope diagnostics" })
+
+vim.cmd("packadd nvim.undotree")
+vim.keymap.set("n", "<leader>u", require("undotree").open)
+
+local neogit = require("neogit")
+neogit.setup({
+ graph_style = "unicode",
+})
+
+vim.keymap.set("n", "<leader>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" },
+ },
+})