commit 441bad3dded1ecd312f5eea0c883a4a06dbd9483 Author: Christopher Williams Date: Sun Jan 11 20:47:39 2026 -0500 Initial Commit diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua new file mode 100644 index 0000000..fe6caae --- /dev/null +++ b/ftplugin/lua.lua @@ -0,0 +1 @@ +vim.treesitter.start() diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..a29ff1d --- /dev/null +++ b/init.lua @@ -0,0 +1,342 @@ +-- vim built in options +vim.g.mapleader = " " +vim.o.relativenumber = true +vim.o.number = true +vim.o.signcolumn = "yes" +vim.o.undofile = true + +vim.o.tabstop = 4 +vim.o.shiftwidth = 0 +vim.o.expandtab = true + +vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()" +vim.wo[0][0].foldmethod = "expr" +vim.o.foldcolumn = "1" +vim.o.foldlevel = 99 +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + +-- require("vim._extui").enable({}) + +-- Lazy plugin manager +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local ensureInstalled = { + "lua", + "python", + "javascript", + "typescript", + "java", + "go", + "rust", + "html", + "css", + "json", + "yaml", + "markdown", + "sql", + "org", + } + local alreadyInstalled = require("nvim-treesitter.config").get_installed() + local parsersToInstall = vim.iter(ensureInstalled) + :filter(function(parser) + return not vim.tbl_contains(alreadyInstalled, parser) + end) + :totable() + require("nvim-treesitter").install(parsersToInstall) + end, + }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + branch = "main", + }, + { + "junegunn/fzf.vim", + dependencies = { + "https://github.com/junegunn/fzf", + }, + keys = { + { "", "Files", desc = "Find files" }, + { ",", "Buffers", desc = "Find buffers" }, + { "/", "Rg", desc = "Search project" }, + }, + }, + { + "stevearc/oil.nvim", + config = function() + require("oil").setup() + end, + keys = { + { "-", "Oil", desc = "Browse files from here" }, + }, + }, + { "nvim-tree/nvim-web-devicons", opts = {} }, + { + "NeogitOrg/neogit", + lazy = true, + dependencies = { + "nvim-lua/plenary.nvim", -- required + "sindrets/diffview.nvim", -- optional - Diff integration + }, + cmd = "Neogit", + keys = { + { "gg", "Neogit", desc = "Show Neogit UI" }, + }, + }, + { + "farmergreg/vim-lastplace", + event = "BufReadPost", + }, + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = function() + require("nvim-autopairs").setup() + end, + }, + { + "numToStr/Comment.nvim", + event = "VeryLazy", + config = function() + require("Comment").setup() + end, + }, + { + "folke/flash.nvim", + event = "VeryLazy", + config = function() + require("flash").setup({ + modes = { + search = { + enabled = true, + }, + char = { + enabled = false, + }, + }, + }) + end, + }, + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + picker = { enabled = true }, + notifier = { enabled = true }, + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { + enabled = true, + animate = { + duration = { step = 10, total = 100 }, + easing = "linear", + }, + }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + }, + config = function(_, opts) + function floating_terminal() + require("snacks").terminal("fish", { + win = { + position = "float", + width = 0.8, + height = 0.8, + border = "rounded", + }, + }) + end + vim.keymap.set("n", "tf", floating_terminal, { desc = "Open floating terminal" }) + vim.keymap.set("n", "\\", floating_terminal, { desc = "Open floating terminal" }) + require("snacks").setup(opts) + end, + }, + { + "lukas-reineke/indent-blankline.nvim", + event = { "VeryLazy" }, + config = function() + require("ibl").setup() + end, + }, + { + "https://github.com/nvim-lualine/lualine.nvim", + event = "VeryLazy", + config = function() + require("lualine").setup() + end, + }, + { + "stevearc/conform.nvim", + opts = {}, + config = function() + local conform = require("conform") + conform.setup({ + formatters_by_ft = { + lua = { "stylua" }, + python = { + "ruff_fix", + "ruff_format", + }, + }, + }) + + -- Command to format buffer or range + vim.api.nvim_create_user_command("Format", function(args) + local range = nil + if args.count ~= -1 then + local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] + range = { + start = { args.line1, 0 }, + ["end"] = { args.line2, end_line:len() }, + } + end + require("conform").format({ + async = true, + lsp_fallback = true, + range = range, + }) + end, { range = true, desc = "Format buffer or range with conform.nvim" }) + + -- Keymap for format + vim.keymap.set("n", "lf", "Format", { desc = "Format buffer with conform.nvim" }) + end, + }, + { + "serhez/bento.nvim", + config = function() + require("bento").setup({ + main_keymap = ",", + }) + end, + }, + { + "zbirenbaum/copilot.lua", + dependencies = { + "copilotlsp-nvim/copilot-lsp", + }, + cmd = "Copilot", + build = ":Copilot auth", + event = "BufReadPost", + config = function() + require("copilot").setup({ + suggestion = { + enabled = true, + auto_trigger = true, + keymap = { + accept = "", + accept_line = "", + accept_word = "", + next = "", + prev = "", + dismiss = "", + }, + }, + nes = { + enabled = false, + keymap = { + accept_and_goto = "p", + accept = false, + dismiss = "", + }, + }, + panel = { enabled = false }, + filetypes = { + lua = true, + markdown = true, + help = true, + }, + }) + vim.api.nvim_create_autocmd("User", { + pattern = "BlinkCmpMenuOpen", + callback = function() + vim.b.copilot_suggestion_hidden = true + end, + }) + + vim.api.nvim_create_autocmd("User", { + pattern = "BlinkCmpMenuClose", + callback = function() + vim.b.copilot_suggestion_hidden = false + end, + }) + end, + }, + { + "CopilotC-Nvim/CopilotChat.nvim", + dependencies = { + { "nvim-lua/plenary.nvim", branch = "master" }, + }, + build = "make tiktoken", + opts = { + -- See Configuration section for options + }, + }, + { + "nvim-orgmode/orgmode", + tag = "0.7.0", + event = "VeryLazy", + ft = { "org" }, + config = function() + require("orgmode").setup({ + org_agenda_files = "~/org/**/*", + org_default_notes_file = "~/org/refile.org", + }) + end, + }, + { + "chipsenkbeil/org-roam.nvim", + tag = "0.2.0", + config = function() + require("org-roam").setup({ + directory = "~/org", + }) + end, + }, + { + "brianhuster/live-preview.nvim", + dependencies = { + "ibhagwan/fzf-lua", + }, + }, + require("plugins.lsp"), +}) + +-- LSP +vim.diagnostic.config({ virtual_text = true }) +vim.lsp.inlay_hint.enable(true) +vim.lsp.enable({ + "luals", +}) + +vim.cmd([[colorscheme tokyonight-night]]) + +require("keymap") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..68c7311 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,37 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "CopilotChat.nvim": { "branch": "main", "commit": "21bdecb25aa72119d11d7fc08c7e0ce323f1b540" }, + "bento.nvim": { "branch": "main", "commit": "d5a2edea7ea2a5353778d0996a881be699eb4402" }, + "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" }, + "conform.nvim": { "branch": "master", "commit": "238f542a118984a88124fc915d5b981680418707" }, + "copilot-lsp": { "branch": "main", "commit": "1b6d8273594643f51bb4c0c1d819bdb21b42159d" }, + "copilot.lua": { "branch": "master", "commit": "5ace9ecd0db9a7a6c14064e4ce4ede5b800325f3" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "fidget.nvim": { "branch": "main", "commit": "64463022a1f2ff1318ab22a2ea4125ed9313a483" }, + "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "fzf": { "branch": "master", "commit": "d1f037059ab57aa1c70abe124b2b72a710f4a28f" }, + "fzf-lua": { "branch": "main", "commit": "e7773d0c863a31bfc8ab72dd1adbec4611a35409" }, + "fzf.vim": { "branch": "master", "commit": "ddc14a6a5471147e2a38e6b32a7268282f669b0a" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, + "live-preview.nvim": { "branch": "main", "commit": "4b4cd2262f7fed487f112e18ddba46dabf0cb7d2" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "neogit": { "branch": "master", "commit": "d8bf9102692250193b855acd9025a826f1af2729" }, + "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, + "nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" }, + "nvim-treesitter": { "branch": "main", "commit": "5a7e5638e7d220575b1c22c8a2e099b52231886e" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "d0d12338230c1ce4ce27373f5b8d50a8c691794b" }, + "nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" }, + "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, + "oil.nvim": { "branch": "master", "commit": "d278dc40f9de9980868a0a55fa666fba5e6aeacb" }, + "org-roam.nvim": { "branch": "main", "commit": "34d1d113cd139ea903125305310be3d7c1067484" }, + "orgmode": { "branch": "master", "commit": "4da28a06d7a8b2563f1308c4550604f36e3c299f" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, + "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, + "swenv.nvim": { "branch": "main", "commit": "4157de2619ec2e5c61c103fb6517845a0e04e558" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" } +} diff --git a/lsp/luals.lua b/lsp/luals.lua new file mode 100644 index 0000000..e0e6126 --- /dev/null +++ b/lsp/luals.lua @@ -0,0 +1,18 @@ +-- luals +return { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + root_markers = { ".luarc.json", ".luarc.jsonc"}, + telemetry = { enabled = false }, + formatters = { + ignoreComments = false + }, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + signatureHelp = { enabled = true }, + } + } +} diff --git a/lsp/rust-analyzer.lua b/lsp/rust-analyzer.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/keymap.lua b/lua/keymap.lua new file mode 100644 index 0000000..561df6e --- /dev/null +++ b/lua/keymap.lua @@ -0,0 +1,15 @@ +-- Window navigation +vim.keymap.set('n', '`', '', { noremap = true, silent = true }) +vim.keymap.set('n', 'wh', 'h', { noremap = true, silent = true }) +vim.keymap.set('n', 'wj', 'j', { noremap = true, silent = true }) +vim.keymap.set('n', 'wk', 'k', { noremap = true, silent = true }) +vim.keymap.set('n', 'wl', 'l', { noremap = true, silent = true }) + +-- Buffer navigation +vim.keymap.set('n', '', '1', { noremap = true, silent = true }) +vim.keymap.set('n', '', '1', { noremap = true, silent = true }) + +-- LSP +vim.keymap.set('n', 'ld', vim.diagnostic.open_float, { noremap = true, silent = true, desc = "Open diagnostics float" }) +vim.keymap.set('n', 'lo', vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "LSP Code Action" }) +vim.keymap.set('n', '', vim.lsp.buf.rename, { noremap = true, silent = true, desc = "LSP Rename" }) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..23eda2a --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,115 @@ +local M = { + { + "neovim/nvim-lspconfig", + config = function() + vim.lsp.enable("rust_analyzer") + vim.lsp.enable("yamlls") + vim.lsp.enable("luals") + vim.lsp.enable("sqls") + vim.lsp.enable("ty") + end, + }, + { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets" }, + + -- use a release tag to download pre-built binaries + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = "default", + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, + + sources = { + -- add lazydev to your completion providers + default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + -- make lazydev completions top priority (see `:h blink.cmp`) + score_offset = 100, + }, + }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, + }, + { + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + { + "j-hui/fidget.nvim", + config = function() + require("fidget").setup() + end, + }, + { + "kevinhwang91/nvim-ufo", + dependencies = { "kevinhwang91/promise-async" }, + config = function() + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + } + local language_servers = vim.lsp.get_clients() -- or list servers manually like {'gopls', 'clangd'} + for _, ls in ipairs(language_servers) do + require("lspconfig")[ls].setup({ + capabilities = capabilities, + -- you can add other fields for setting up lsp server in this table + }) + end + require("ufo").setup() + end, + }, + { + "AckslD/swenv.nvim", + }, +} + +return M