From 441f39ba0c2f3f52fadbf60db0d87a2e43f3f6bc Mon Sep 17 00:00:00 2001 From: Noah Pederson Date: Tue, 17 Sep 2024 09:36:01 -0500 Subject: [PATCH] Cleanup nvim config --- nvim/init.lua | 8 +++- nvim/lua/completion.lua | 82 +++++++++++++++++++++-------------------- nvim/lua/plugins.lua | 49 ++++++++++++++---------- 3 files changed, 78 insertions(+), 61 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 7304d6b..b5c0bf7 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -140,6 +140,12 @@ keymap({ "n", "i", "v" }, "", "Telescope", silentnoremap) -- LSP Documentation viewer keymap("n", "K", "lua vim.lsp.buf.hover()", silentnoremap) +-- Lf +keymap("n", "l", "Lf", silentnoremap) + +-- Neogit +keymap("n", "g", "Neogit", silentnoremap) + -- Autoformat! vim.api.nvim_create_user_command("Format", function(args) local range = nil @@ -162,5 +168,3 @@ vim.g.python3_host_prog = vim.fn.expand("~/.envs/nvim/bin/python3") -- ######################## -- LSP require("lsp") --- Completion -require("completion") diff --git a/nvim/lua/completion.lua b/nvim/lua/completion.lua index bd218d8..c21a2be 100644 --- a/nvim/lua/completion.lua +++ b/nvim/lua/completion.lua @@ -1,42 +1,44 @@ -- Copied from https://github.com/hrsh7th/nvim-cmp/?tab=readme-ov-file#recommended-configuration -local cmp = require('cmp') -cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - end - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered() - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }) -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'lazydev', group_index = 0 }, - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - { name = 'supermaven' }, - { name = 'conjure' }, - }, - { { name = 'buffer' } }) -}) -require("cmp_git").setup() --- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { { name = 'buffer' } } -}) +return function() + local cmp = require('cmp') + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + end + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered() + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }) -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'lazydev', group_index = 0 }, + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + { name = 'supermaven' }, + { name = 'conjure' }, + }, + { { name = 'buffer' } }) + }) + require("cmp_git").setup() + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { { name = 'buffer' } } + }) --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), - matching = { disallow_symbol_nonprefix_matching = false } -}) + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), + matching = { disallow_symbol_nonprefix_matching = false } + }) +end diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 99668ed..c01fc9b 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -34,14 +34,14 @@ require("lazy").setup({ main = "everforest", opts = { background = "hard" } }, - { "rebelot/kanagawa.nvim", opts = { compile = true }, priority = 1000, lazy = true }, + { "rebelot/kanagawa.nvim", opts = { compile = true }, priority = 1000, lazy = true }, { 'jesseleite/nvim-noirbuddy', dependencies = { 'tjdevries/colorbuddy.nvim', }, lazy = true, - --priority = 1000, + priority = 1000, opts = { -- All of your `setup(opts)` will go here preset = "slate", @@ -58,7 +58,8 @@ require("lazy").setup({ "hrsh7th/vim-vsnip", "petertriho/cmp-git", "hrsh7th/cmp-cmdline" - } + }, + config = require('completion') }, -- nvim lsp plugins { "neovim/nvim-lspconfig", @@ -97,7 +98,6 @@ require("lazy").setup({ }, -- Git stuff -- GitGutter, shows inline difs "airblade/vim-gitgutter", - -- "tpope/vim-fugitive", -- old git command { "NeogitOrg/neogit", dependencies = { @@ -146,6 +146,7 @@ require("lazy").setup({ }, { "nvim-lualine/lualine.nvim", + config = true, dependencies = { "nvim-tree/nvim-web-devicons" } }, -- Fuzzy finding stuff @@ -155,10 +156,12 @@ require("lazy").setup({ build = function() vim.fn["fzf#install"](0) end, dependencies = { "junegunn/fzf.vim" } }, + -- A lua + nvim stdlib sort of thing + { "nvim-lua/plenary.nvim", lazy = true, }, -- Telescope, find anything fast - "nvim-lua/plenary.nvim", { "nvim-telescope/telescope.nvim", + config = true, dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope-symbols.nvim", @@ -166,7 +169,8 @@ require("lazy").setup({ }, { "folke/trouble.nvim", - dependencies = "nvim-tree/nvim-web-devicons" + dependencies = "nvim-tree/nvim-web-devicons", + config = true, }, -- Which key is bound? -- literally the best plugin ever @@ -213,6 +217,7 @@ require("lazy").setup({ { "gpanders/nvim-parinfer", ft = { "hy", "scheme", "scm", "clojure", "fennel", "janet", "lisp", "python", "lua" }, + lazy = true, config = function() vim.g.parinfer_comment_chars = { ";", "#" } vim.g.parinfer_force_balance = true @@ -289,6 +294,7 @@ require("lazy").setup({ }, }) end, + lazy = true, ft = { "hy", "scheme", "scm", "clojure", "fennel", "janet", "lisp", "python", "lua" } }, { @@ -303,6 +309,7 @@ require("lazy").setup({ { "julienvincent/nvim-paredit-fennel", dependencies = { "julienvincent/nvim-paredit" }, + lazy = true, ft = { "fennel" }, config = true, }, @@ -314,24 +321,26 @@ require("lazy").setup({ require("nvim-paredit-scheme").setup(require("nvim-paredit")) end, }, - { "hiphish/rainbow-delimiters.nvim" }, + { "hiphish/rainbow-delimiters.nvim", priority = 1050, }, -- Conjure, lisp is magical { "Olical/conjure", - ft = { "scheme", "scm", "lisp", "fennel", "clojure", "lua", "janet" }, + dependencies = { "PaterJason/cmp-conjure" }, config = function() vim.g["conjure#client#scheme#stdio#command"] = "gxi" vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "%d*> $?" end, - dependencies = { "PaterJason/cmp-conjure" } + lazy = true, + ft = { "scheme", "scm", "lisp", "fennel", "clojure", "lua", "janet" }, }, - { "PaterJason/cmp-conjure", lazy = true }, - { "p1xelHer0/gerbil.nvim", ft = "scheme" }, -- Fennel, Luasthp - { "jaawerth/fennel.vim", lazy = true, ft = "fennel" }, - { "rktjmp/hotpot.nvim", lazy = true, ft = "fennel" }, - { "Olical/nfnl", ft = "fennel" }, -- Rust stuff + { "PaterJason/cmp-conjure", lazy = true }, + { "p1xelHer0/gerbil.nvim", lazy = true, ft = "scheme", config = true }, -- Fennel, Luasthp + { "jaawerth/fennel.vim", lazy = true, ft = "fennel", config = true }, + { "rktjmp/hotpot.nvim", lazy = true, ft = "fennel", config = true }, + { "Olical/nfnl", lazy = true, ft = "fennel", config = true }, -- Rust stuff { "simrat39/rust-tools.nvim", + lazy = true, ft = { "rust" }, config = function() local rt = require("rust-tools") @@ -352,24 +361,26 @@ require("lazy").setup({ end, dependencies = { "nvim-lua/plenary.nvim" } }, - { "mfussenegger/nvim-dap", lazy = true, ft = { "c", "rust" } }, + { "mfussenegger/nvim-dap", lazy = true, ft = { "c", "rust" }, config = true }, { "saecki/crates.nvim", tag = "v0.4.0", dependencies = { "nvim-lua/plenary.nvim" }, config = function() require("crates").setup() end, + lazy = true, ft = { "rust" } }, -- RISC-V Assembly syntax highlighting { "kylelaker/riscv.vim", ft = "riscv" }, -- Hare Stuff -- Haredoc { url = "https://git.sr.ht/~torresjrjr/vim-haredoc", + lazy = true, ft = { "hare" }, branch = "dev" - }, -- Hare.vim - { url = "https://git.sr.ht/~sircmpwn/hare.vim", ft = { "hare" } }, -- TCL - { "lewis6991/tree-sitter-tcl", build = "make" }, -- LF - { "ptzz/lf.vim", cmd = { "Lf" }, dependencies = { "voldikss/vim-floaterm" } }, + }, -- Hare.vim + { url = "https://git.sr.ht/~sircmpwn/hare.vim", ft = { "hare" } }, -- TCL + { "lewis6991/tree-sitter-tcl", lazy = true, build = "make" }, -- LF + { "ptzz/lf.vim", lazy = true, cmd = { "Lf" }, dependencies = { "voldikss/vim-floaterm" } }, -- SuperMaven, another AI coding tool { "supermaven-inc/supermaven-nvim", -- 2.51.2