commit 0485e97fd2f9854183322ef521d67d790b119748 Author: hgranthorner <37941012+hgranthorner@users.noreply.github.com> Date: Mon Sep 14 16:09:15 2026 -0400 initial commit diff --git a/after/ftplugin/lua.lua b/after/ftplugin/lua.lua new file mode 100644 index 0000000..6e32026 --- /dev/null +++ b/after/ftplugin/lua.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "x", "source", { buf = 0 }) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..0311536 --- /dev/null +++ b/init.lua @@ -0,0 +1,131 @@ +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 in normal mode +-- See `:help hlsearch` +vim.keymap.set("n", "", "nohlsearch") + +-- 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", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) +vim.keymap.set("n", "so", "so") +vim.keymap.set("n", "ei", function() + vim.cmd([[edit $MYVIMRC]]) +end) + +vim.keymap.set("t", "", "", { 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", "" .. 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" }, "", add_mcursor_to_selection) + +require("plugins.mini") +require("plugins.oil") +require("plugins.fugitive") +require("plugins.conform") + +require("settings.lsp") diff --git a/lsp/gopls.lua b/lsp/gopls.lua new file mode 100644 index 0000000..e9f6e7c --- /dev/null +++ b/lsp/gopls.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'gopls' }, + filetypes = { 'go' }, + root_markers = { 'go.mod', '.git' }, +} diff --git a/lsp/lua_ls.lua b/lsp/lua_ls.lua new file mode 100644 index 0000000..93dcb73 --- /dev/null +++ b/lsp/lua_ls.lua @@ -0,0 +1,24 @@ +return { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + root_markers = { ".luarc.json", ".luarc.jsonc", ".git" }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { 'vim' }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + }, + telemetry = { + enable = false, + }, + }, + }, +} diff --git a/lsp/ruby_lsp.lua b/lsp/ruby_lsp.lua new file mode 100644 index 0000000..da11e15 --- /dev/null +++ b/lsp/ruby_lsp.lua @@ -0,0 +1,5 @@ +return { + cmd = { "mise", "x", "--", "ruby-lsp" }, + filetypes = { "ruby" }, + root_markers = { ".git", "Gemfile" } +} diff --git a/lsp/tsc.lua b/lsp/tsc.lua new file mode 100644 index 0000000..e4b486a --- /dev/null +++ b/lsp/tsc.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'tsc', '--lsp', '--stdio' }, + filetypes = { 'javascript', 'typescript', 'typescriptreact', 'javascriptreact' }, + root_markers = { '.git', 'package.json' } +} diff --git a/lsp/tsserver.lua b/lsp/tsserver.lua new file mode 100644 index 0000000..c55e284 --- /dev/null +++ b/lsp/tsserver.lua @@ -0,0 +1,5 @@ +return { + cmd = { "npx", "typescript-language-server", "--stdio" }, + filetypes = { 'javascript', 'typescript', 'typescriptreact', 'javascriptreact' }, + root_markers = { '.git', 'package.json' } +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..519efd4 --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,18 @@ +vim.pack.add({ + "https://github.com/stevearc/conform.nvim", +}) + +require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + -- Conform will run the first available formatter + javascript = { "prettierd", "prettier", stop_after_first = true }, + }, +}) + +vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*", + callback = function(args) + require("conform").format({ bufnr = args.buf }) + end, +}) diff --git a/lua/plugins/fugitive.lua b/lua/plugins/fugitive.lua new file mode 100644 index 0000000..e4c0f15 --- /dev/null +++ b/lua/plugins/fugitive.lua @@ -0,0 +1,5 @@ +vim.pack.add({ + 'https://github.com/tpope/vim-fugitive', +}) + +vim.keymap.set("n", "gg", "Git") diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua new file mode 100644 index 0000000..7116444 --- /dev/null +++ b/lua/plugins/mini.lua @@ -0,0 +1,25 @@ +local nmap_leader = function(suffix, rhs, desc) + vim.keymap.set('n', '' .. suffix, rhs, { desc = desc }) +end + +vim.pack.add({ + 'https://github.com/nvim-mini/mini.nvim', +}) + +require('mini.pick').setup() + +nmap_leader('ff', 'Pick files', 'Files') +nmap_leader('fc', function() + MiniPick.builtin.files({}, {source = {cwd = vim.fn.stdpath('config')}}) +end, 'Config') +nmap_leader('fb', 'Pick buffers', 'Buffers') +nmap_leader('fh', 'Pick help', 'Help') +nmap_leader('fg', 'Pick grep_live', 'Grep') + +require('mini.diff').setup() +require('mini.move').setup() + +require('mini.surround').setup() +MiniFiles = require('mini.files') +MiniFiles.setup() +nmap_leader('ft', MiniFiles.open, 'Tree') diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua new file mode 100644 index 0000000..2aeb437 --- /dev/null +++ b/lua/plugins/oil.lua @@ -0,0 +1,12 @@ +vim.pack.add({ + 'https://github.com/stevearc/oil.nvim', +}) + +require("oil").setup() + +local nmap_leader = function(suffix, rhs, desc) + vim.keymap.set('n', '' .. suffix, rhs, { desc = desc }) +end + +nmap_leader('rw', function() vim.cmd[[Oil]] end) + diff --git a/lua/settings/lsp.lua b/lua/settings/lsp.lua new file mode 100644 index 0000000..3786ecc --- /dev/null +++ b/lua/settings/lsp.lua @@ -0,0 +1,6 @@ +vim.keymap.set("n", "K", function() + vim.lsp.buf.hover({ border = "rounded" }) +end) +vim.keymap.set("n", "grd", vim.lsp.buf.definition) + +vim.lsp.enable({'gopls', 'tsserver', 'lua_ls', 'ruby_lsp'}) diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json new file mode 100644 index 0000000..dbb77be --- /dev/null +++ b/nvim-pack-lock.json @@ -0,0 +1,28 @@ +{ + "plugins": { + "colorbuddy.nvim": { + "rev": "8b968581e5c19d22a861d5f3fe5dbd83394fa681", + "src": "https://github.com/tjdevries/colorbuddy.nvim" + }, + "conform.nvim": { + "rev": "016802de402556da54c36bd7359b441266b01cdd", + "src": "https://github.com/stevearc/conform.nvim" + }, + "ghosttybuddy.nvim": { + "rev": "1aea43228171a123424559002e13a2310c25ec0e", + "src": "https://github.com/hgranthorner/ghosttybuddy.nvim" + }, + "mini.nvim": { + "rev": "8cef23520832134c05e4524e49f0468623501053", + "src": "https://github.com/nvim-mini/mini.nvim" + }, + "oil.nvim": { + "rev": "b73018b75affd13fa38e2fc94ef753b465f770d7", + "src": "https://github.com/stevearc/oil.nvim" + }, + "vim-fugitive": { + "rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0", + "src": "https://github.com/tpope/vim-fugitive" + } + } +}