From ccd97d54e80bdbb95ff299c2c78ee1d98385d6e8 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Sun, 27 Jul 2025 20:28:04 -0400 Subject: [PATCH] chore(nvim): upgrade from astronvim v3 to v5 (#14) * chore(nvim): upgrade to astronvim v4 oof * chore(nvim): upgrade to astronvim v5 * fix(nvim): add back ruby lsp * chore(nvim): update lockfile * refactor(nvim): sort plugins --- config/nvim/.neoconf.json | 20 ++++ config/nvim/.stylua.toml | 7 ++ config/nvim/README.md | 34 ++++++ config/nvim/init.lua | 19 ++++ config/nvim/lazy-lock.json | 57 ++++++++++ config/nvim/lua/community.lua | 10 ++ config/nvim/lua/lazy_setup.lua | 32 ++++++ config/nvim/lua/plugins/astrocore.lua | 105 ++++++++++++++++++ config/nvim/lua/plugins/astrolsp.lua | 98 ++++++++++++++++ config/nvim/lua/plugins/astroui.lua | 11 ++ config/nvim/lua/plugins/better-escape.lua | 5 + config/nvim/lua/plugins/blink.cmp.lua | 19 ++++ .../nvim/lua/plugins/mason-tool-installer.lua | 39 +++++++ config/nvim/lua/plugins/none-ls.lua | 24 ++++ config/nvim/lua/plugins/nvim-autopairs.lua | 5 + config/nvim/lua/plugins/treesitter.lua | 74 ++++++++++++ config/nvim/lua/{user => }/plugins/user.lua | 3 + config/nvim/lua/polish.lua | 18 +++ config/nvim/lua/user/README.md | 28 ----- config/nvim/lua/user/init.lua | 92 --------------- config/nvim/lua/user/mappings.lua | 60 ---------- config/nvim/lua/user/options.lua | 30 ----- config/nvim/lua/user/plugins/community.lua | 5 - config/nvim/lua/user/plugins/core.lua | 26 ----- config/nvim/neovim.yml | 6 + config/nvim/selene.toml | 8 ++ 26 files changed, 594 insertions(+), 241 deletions(-) create mode 100644 config/nvim/.neoconf.json create mode 100644 config/nvim/.stylua.toml create mode 100644 config/nvim/README.md create mode 100644 config/nvim/init.lua create mode 100644 config/nvim/lazy-lock.json create mode 100644 config/nvim/lua/community.lua create mode 100644 config/nvim/lua/lazy_setup.lua create mode 100644 config/nvim/lua/plugins/astrocore.lua create mode 100644 config/nvim/lua/plugins/astrolsp.lua create mode 100644 config/nvim/lua/plugins/astroui.lua create mode 100644 config/nvim/lua/plugins/better-escape.lua create mode 100644 config/nvim/lua/plugins/blink.cmp.lua create mode 100644 config/nvim/lua/plugins/mason-tool-installer.lua create mode 100644 config/nvim/lua/plugins/none-ls.lua create mode 100644 config/nvim/lua/plugins/nvim-autopairs.lua create mode 100644 config/nvim/lua/plugins/treesitter.lua rename config/nvim/lua/{user => }/plugins/user.lua (73%) create mode 100644 config/nvim/lua/polish.lua delete mode 100644 config/nvim/lua/user/README.md delete mode 100644 config/nvim/lua/user/init.lua delete mode 100644 config/nvim/lua/user/mappings.lua delete mode 100644 config/nvim/lua/user/options.lua delete mode 100644 config/nvim/lua/user/plugins/community.lua delete mode 100644 config/nvim/lua/user/plugins/core.lua create mode 100644 config/nvim/neovim.yml create mode 100644 config/nvim/selene.toml diff --git a/config/nvim/.neoconf.json b/config/nvim/.neoconf.json new file mode 100644 index 0000000..2d7a81f --- /dev/null +++ b/config/nvim/.neoconf.json @@ -0,0 +1,20 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + }, + "lspconfig": { + "lua_ls": { + "Lua.format.enable": false + } + } +} diff --git a/config/nvim/.stylua.toml b/config/nvim/.stylua.toml new file mode 100644 index 0000000..bfcffff --- /dev/null +++ b/config/nvim/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" +collapse_simple_statement = "Always" diff --git a/config/nvim/README.md b/config/nvim/README.md new file mode 100644 index 0000000..365674b --- /dev/null +++ b/config/nvim/README.md @@ -0,0 +1,34 @@ +# AstroNvim Template + +**NOTE:** This is for AstroNvim v4+ + +A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim) + +## 🛠️ Installation + +#### Make a backup of your current nvim and shared folder + +```shell +mv ~/.config/nvim ~/.config/nvim.bak +mv ~/.local/share/nvim ~/.local/share/nvim.bak +mv ~/.local/state/nvim ~/.local/state/nvim.bak +mv ~/.cache/nvim ~/.cache/nvim.bak +``` + +#### Create a new user repository from this template + +Press the "Use this template" button above to create a new repository to store your user configuration. + +You can also just clone this repository directly if you do not want to track your user configuration in GitHub. + +#### Clone the repository + +```shell +git clone https://github.com// ~/.config/nvim +``` + +#### Start Neovim + +```shell +nvim +``` diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..2ce1cdd --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,19 @@ +-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution +-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk. +local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" +if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +-- validate that lazy is available +if not pcall(require, "lazy") then + -- stylua: ignore + vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() +end + +require "lazy_setup" +require "polish" diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json new file mode 100644 index 0000000..53b2d27 --- /dev/null +++ b/config/nvim/lazy-lock.json @@ -0,0 +1,57 @@ +{ + "AstroNvim": { "branch": "main", "commit": "99a6f33c964fab5dd05f2f10c215ff7697e9b3a8" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "aerial.nvim": { "branch": "master", "commit": "3284a2cb858ba009c79da87d5e010ccee3c99c4d" }, + "astrocommunity": { "branch": "main", "commit": "b3ed1de31b0109b28668385336f84dc60c792de3" }, + "astrocore": { "branch": "main", "commit": "c797dd5a592e2bd154f2503e231b8a4083659534" }, + "astrolsp": { "branch": "main", "commit": "414775e4b49a46bd7105cc5498ea7bb312359bf2" }, + "astrotheme": { "branch": "main", "commit": "f12dcf64b1f9a05839c3ac2146f550f43bae9dab" }, + "astroui": { "branch": "main", "commit": "4943abbd42674b43249313afe83b91065a40e4be" }, + "better-escape.nvim": { "branch": "master", "commit": "199dcc2643dec5d8dbdab4ec672cf405224dcb3b" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, + "cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" }, + "colorbuddy.nvim": { "branch": "master", "commit": "8b968581e5c19d22a861d5f3fe5dbd83394fa681" }, + "copilot.lua": { "branch": "master", "commit": "4958fb9390f624cb389be2772e3c5e718e94d8b6" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "heirline.nvim": { "branch": "master", "commit": "fae936abb5e0345b85c3a03ecf38525b0828b992" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "197f6352c276bbc2d25541dfce00ec50d1a4e88f" }, + "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, + "neo-tree.nvim": { "branch": "main", "commit": "cea666ef965884414b1b71f6b39a537f9238bdb2" }, + "neoconf.nvim": { "branch": "main", "commit": "d0a2652eb8e9fc4e6f531a622c8f32eb78b44a98" }, + "neosolarized.nvim": { "branch": "main", "commit": "0c01fd2ac2ab33918073f57c63bcb2ae5a31d8de" }, + "none-ls.nvim": { "branch": "main", "commit": "3ce66bc62eb363f19cceeb1fae2e71ea2bede56d" }, + "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, + "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, + "nvim-dap": { "branch": "master", "commit": "5dd4d50f2e6a2eaf9e57fad023d294ef371bda35" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-highlight-colors": { "branch": "main", "commit": "b42a5ccec7457b44e89f7ed3b3afb1b375bb2093" }, + "nvim-lspconfig": { "branch": "master", "commit": "fa2662510d30b06168b6e2e6915518decde6bbac" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-surround": { "branch": "main", "commit": "7a7a78a52219a3312c1fcabf880cea07a7956a5f" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, + "nvim-ufo": { "branch": "main", "commit": "61463090a4f55f5d080236ea62f09d1cd8976ff3" }, + "nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" }, + "smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" }, + "snacks.nvim": { "branch": "main", "commit": "5eac729fa290248acfe10916d92a5ed5e5c0f9ed" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, + "vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }, + "vim-rhubarb": { "branch": "master", "commit": "5496d7c94581c4c9ad7430357449bb57fc59f501" }, + "which-key.nvim": { "branch": "main", "commit": "fcbf4eea17cb299c02557d576f0d568878e354a4" } +} diff --git a/config/nvim/lua/community.lua b/config/nvim/lua/community.lua new file mode 100644 index 0000000..b9b5b22 --- /dev/null +++ b/config/nvim/lua/community.lua @@ -0,0 +1,10 @@ +-- AstroCommunity: import any community modules here +-- We import this file in `lazy_setup.lua` before the `plugins/` folder. +-- This guarantees that the specs are processed before any user plugins. + +---@type LazySpec +return { + "AstroNvim/astrocommunity", + { import = "astrocommunity.completion.copilot-lua" }, + { import = "astrocommunity.colorscheme.neosolarized-nvim" }, +} diff --git a/config/nvim/lua/lazy_setup.lua b/config/nvim/lua/lazy_setup.lua new file mode 100644 index 0000000..4d9552f --- /dev/null +++ b/config/nvim/lua/lazy_setup.lua @@ -0,0 +1,32 @@ +require("lazy").setup({ + { + "AstroNvim/AstroNvim", + version = "^5", -- Remove version tracking to elect for nightly AstroNvim + import = "astronvim.plugins", + opts = { -- AstroNvim options must be set here with the `import` key + mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up + maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up + icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) + pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override + update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins + }, + }, + { import = "community" }, + { import = "plugins" }, +} --[[@as LazySpec]], { + -- Configure any other `lazy.nvim` configuration options here + install = { colorscheme = { "astrotheme", "habamax" } }, + ui = { backdrop = 100 }, + performance = { + rtp = { + -- disable some rtp plugins, add more to your liking + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "zipPlugin", + }, + }, + }, +} --[[@as LazyConfig]]) diff --git a/config/nvim/lua/plugins/astrocore.lua b/config/nvim/lua/plugins/astrocore.lua new file mode 100644 index 0000000..ad64f4a --- /dev/null +++ b/config/nvim/lua/plugins/astrocore.lua @@ -0,0 +1,105 @@ +-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! +-- Configuration documentation can be found with `:h astrocore` + +---@type LazySpec + +-- TODO(serhalp) I have no idea what I'm doing here, but I imagine there's a +-- more neovim/lua-native way to define these helpers. +vim.api.nvim_create_user_command("CopyCurBufAbsPathToClipboard", function() + local path = vim.fn.expand("%:p") + vim.fn.setreg("+", path) + vim.notify('Copied "' .. path .. '" to the clipboard!') +end, {}) +vim.api.nvim_create_user_command("CopyCurBufRelPathToClipboard", function() + local path = vim.fn.fnamemodify(vim.fn.expand("%"), ":.") + vim.fn.setreg("+", path) + vim.notify('Copied "' .. path .. '" to the clipboard!') +end, {}) + +return { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + -- Configure core features of AstroNvim + features = { + large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + autopairs = true, + cmp = true, + diagnostics = true, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) + highlighturl = true, + notifications = true, + }, + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + -- vim options can be configured here + options = { + opt = { -- vim.opt. + relativenumber = false, + number = true, + spell = false, + signcolumn = "auto", + wrap = false, + guifont = "Inconsolata Nerd Font Mono", + textwidth = 100, + }, + }, + -- Mappings can be configured through AstroCore as well. + -- NOTE: keycodes follow the casing in the vimdocs. For example, `` must be capitalized + mappings = { + -- first key is the mode + -- second key is the lefthand side of the map + + -- tables with just a `desc` key will be registered with which-key if it's installed + -- this is useful for naming menus + -- ["b"] = { desc = "Buffers" }, + + -- setting a mapping to false will disable it + -- [""] = false, + + n = { + [""] = { "" }, + ["Q"] = { "gq" }, + + -- "Chordless" keys to move between windows + ["gj"] = { "j" }, + ["gk"] = { "k" }, + ["gh"] = { "h" }, + ["gl"] = { "l" }, + + -- Copy current filename to system clipboard + ["f"] = { "CopyCurBufRelPathToClipboard", desc = "Copy buffer rel. path to clipboard" }, + ["F"] = { "CopyCurBufAbsPathToClipboard", desc = "Copy buffer abs. path to clipboard" }, + + -- Move a line of text around with Alt+j/Alt+k + [""] = { "mz:m+`z" }, + [""] = { "mz:m-2`z" }, + + -- Toggle file explorer (tree-sitter) with current file focused + ["E"] = { "Neotree focus reveal", desc = "Toggle Explorer w/ file focused" }, + }, + v = { + [""] = { "gV" }, + + -- Move selected lines around with Alt+j/Alt+k + [""] = { ":m'>+`mzgv`yo`z" }, + [""] = { ":m'<-2`>my`"] = { "" }, + }, + i = { + [""] = { "`^" }, + + -- Some basic readline mappings in insert mode + [""] = { "" }, + [""] = { "" }, + [""] = { "" }, + }, + t = { + }, + }, + }, +} diff --git a/config/nvim/lua/plugins/astrolsp.lua b/config/nvim/lua/plugins/astrolsp.lua new file mode 100644 index 0000000..e837b4c --- /dev/null +++ b/config/nvim/lua/plugins/astrolsp.lua @@ -0,0 +1,98 @@ +-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine +-- Configuration documentation can be found with `:h astrolsp` + +---@type LazySpec +return { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start + semantic_tokens = true, -- enable/disable semantic token highlighting + }, + formatting = { + format_on_save = { + enabled = true, + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- disable lua_ls formatting capability if you want to use StyLua to format your lua code + -- "lua_ls", + }, + timeout_ms = 5000, + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + }, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + }, + -- customize how language servers are attached + handlers = { + -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server + -- function(server, opts) require("lspconfig")[server].setup(opts) end + + -- the key is the server that is being setup with `lspconfig` + -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server + -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed + }, + -- Configure buffer local auto commands to add when attaching a language server + autocmds = { + -- first key is the `augroup` to add the auto commands to (:h augroup) + -- lsp_codelens_refresh = { + -- Optional condition to create/delete auto command group + -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` + -- condition will be resolved for each client on each execution and if it ever fails for all clients, + -- the auto commands will be deleted for that buffer + -- cond = "textDocument/codeLens", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + -- { + -- events to trigger + -- event = { "InsertLeave", "BufEnter" }, + -- the rest of the autocmd options (:h nvim_create_autocmd) + -- desc = "Refresh codelens (buffer)", + -- callback = function(args) + -- if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end + -- end, + -- }, + -- }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean + gD = { + function() vim.lsp.buf.declaration() end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + ["uY"] = { + function() require("astrolsp.toggles").buffer_semantic_tokens() end, + desc = "Toggle LSP semantic highlight (buffer)", + cond = function(client) + return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil + end, + }, + -- I use gh/gj/gk/gl for window navigation; AstroNvim uses `gl`, but same as `ld`. + gl = false, + }, + }, + -- A custom `on_attach` function to be run after the default `on_attach` function + -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + -- on_attach = function(client, bufnr) + -- this would disable semanticTokensProvider for all clients + -- client.server_capabilities.semanticTokensProvider = nil + -- end, + }, +} diff --git a/config/nvim/lua/plugins/astroui.lua b/config/nvim/lua/plugins/astroui.lua new file mode 100644 index 0000000..6cc6c30 --- /dev/null +++ b/config/nvim/lua/plugins/astroui.lua @@ -0,0 +1,11 @@ +-- AstroUI provides the basis for configuring the AstroNvim User Interface +-- Configuration documentation can be found with `:h astroui` + +---@type LazySpec +return { + "AstroNvim/astroui", + ---@type AstroUIOpts + opts = { + colorscheme = "neosolarized", + }, +} diff --git a/config/nvim/lua/plugins/better-escape.lua b/config/nvim/lua/plugins/better-escape.lua new file mode 100644 index 0000000..f3000b6 --- /dev/null +++ b/config/nvim/lua/plugins/better-escape.lua @@ -0,0 +1,5 @@ +---@type LazySpec +return { + "max397574/better-escape.nvim", + enabled = false +} diff --git a/config/nvim/lua/plugins/blink.cmp.lua b/config/nvim/lua/plugins/blink.cmp.lua new file mode 100644 index 0000000..7a3dd76 --- /dev/null +++ b/config/nvim/lua/plugins/blink.cmp.lua @@ -0,0 +1,19 @@ +local blink = require "blink.cmp" + +---@type LazySpec +return { + "Saghen/blink.cmp", + opts = { + keymap = { -- Mappings are defined in the keymap table + -- I use Ctrl-Space at the OS level + [""] = false, + -- Unnecessary and potentially confusing + [""] = false, + -- Unnecessary and potentially confusing + [""] = false, + -- Incompatible with my using for + [""] = false, + [""] = false, + }, + }, +} diff --git a/config/nvim/lua/plugins/mason-tool-installer.lua b/config/nvim/lua/plugins/mason-tool-installer.lua new file mode 100644 index 0000000..1a7e9e8 --- /dev/null +++ b/config/nvim/lua/plugins/mason-tool-installer.lua @@ -0,0 +1,39 @@ +---@type LazySpec +return { + -- use mason-tool-installer to configure LSP, DAP, and Formatter/Linter installations + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + -- overrides `require("mason-tool-installer").setup(...)` + opts = { + ensure_installed = { + "angular-language-server", + "astro-language-server", + "bash-language-server", + -- TODO(serhalp) Configure conditional loading for Biome projects + -- "biome", + -- TODO(serhalp) Conditionally enable commitlint + -- "commitlint", + "css-lsp", + -- FIXME(serhalp) Configure conditional loading for Deno files + -- "deno", + "eslint-lsp", + "html-lsp", + "json-lsp", + "lua-language-server", + "marksman", + "mdx-analyzer", + "prettier", + "python-lsp-server", + -- TODO(serhalp) Use this instead of `marksman`? + -- "remark-language-server", + "ruby-lsp", + "shellcheck", + "stylua", + "svelte-language-server", + "tailwindcss-language-server", + "typescript-language-server", + "vim-language-server", + }, + }, + }, +} diff --git a/config/nvim/lua/plugins/none-ls.lua b/config/nvim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..2b0ed18 --- /dev/null +++ b/config/nvim/lua/plugins/none-ls.lua @@ -0,0 +1,24 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize None-ls sources + +---@type LazySpec +return { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + -- opts variable is the default configuration table for the setup function call + -- local null_ls = require "null-ls" + + -- Check supported formatters and linters + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + + -- Only insert new sources, do not replace the existing ones + -- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function) + opts.sources = require("astrocore").list_insert_unique(opts.sources, { + -- Set a formatter + -- null_ls.builtins.formatting.stylua, + -- null_ls.builtins.formatting.prettier, + }) + end, +} diff --git a/config/nvim/lua/plugins/nvim-autopairs.lua b/config/nvim/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..697636f --- /dev/null +++ b/config/nvim/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,5 @@ +---@type LazySpec +return { + "windwp/nvim-autopairs", + enabled = false +} diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..287c011 --- /dev/null +++ b/config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,74 @@ +---@type LazySpec +return { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "angular", + "astro", + "bash", + "c", + "cpp", + "css", + "csv", + "dockerfile", + "editorconfig", + "elixir", + "elm", + "erlang", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "go", + "gomod", + "gosum", + "graphql", + "haskell", + "html", + "java", + "javascript", + "jinja", + "jinja_inline", + "jq", + "json", + "json5", + "jsonc", + "lua", + "make", + "markdown", + "markdown_inline", + "mermaid", + "nginx", + "pem", + "perl", + "php", + "powershell", + "printf", + "prisma", + "pug", + "python", + "r", + "regex", + "requirements", + "ruby", + "rust", + "scala", + "scheme", + "scss", + "sql", + "ssh_config", + "svelte", + "swift", + "terraform", + "toml", + "tsv", + "typescript", + "vim", + "vimdoc", + "vue", + "xml", + "yaml", + }, + }, +} diff --git a/config/nvim/lua/user/plugins/user.lua b/config/nvim/lua/plugins/user.lua similarity index 73% rename from config/nvim/lua/user/plugins/user.lua rename to config/nvim/lua/plugins/user.lua index 8bf87ef..a237f6f 100644 --- a/config/nvim/lua/user/plugins/user.lua +++ b/config/nvim/lua/plugins/user.lua @@ -1,3 +1,6 @@ +-- You can also add or configure plugins by creating files in this `plugins/` folder + +---@type LazySpec return { { "kylechui/nvim-surround", diff --git a/config/nvim/lua/polish.lua b/config/nvim/lua/polish.lua new file mode 100644 index 0000000..5b65b7d --- /dev/null +++ b/config/nvim/lua/polish.lua @@ -0,0 +1,18 @@ +if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- This will run last in the setup process and is a good place to configure +-- things like custom filetypes. This is just pure lua so anything that doesn't +-- fit in the normal config locations above can go here + +-- Set up custom filetypes +vim.filetype.add { + extension = { + foo = "fooscript", + }, + filename = { + ["Foofile"] = "fooscript", + }, + pattern = { + ["~/%.config/foo/.*"] = "fooscript", + }, +} diff --git a/config/nvim/lua/user/README.md b/config/nvim/lua/user/README.md deleted file mode 100644 index 75ba351..0000000 --- a/config/nvim/lua/user/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# AstroNvim User Configuration - -## 🛠️ Installation - -### Make a backup of your current nvim and shared folder - -```shell -mv ~/.config/nvim ~/.config/nvim.bak -mv ~/.local/share/nvim ~/.local/share/nvim.bak -``` - -### Clone AstroNvim base config - -```shell -git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim -``` - -### Copy my user config - -```shell -cp ~/.config/nvim/lua/user -``` - -### Start Neovim - -```shell -nvim -``` diff --git a/config/nvim/lua/user/init.lua b/config/nvim/lua/user/init.lua deleted file mode 100644 index 2589fb3..0000000 --- a/config/nvim/lua/user/init.lua +++ /dev/null @@ -1,92 +0,0 @@ -return { - -- Configure AstroNvim updates - updater = { - remote = "origin", -- remote to use - channel = "stable", -- "stable" or "nightly" - version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) - -- branch = "nightly", -- branch name (NIGHTLY ONLY) - -- commit = nil, -- commit hash (NIGHTLY ONLY) - pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only) - skip_prompts = false, -- skip prompts about breaking changes - show_changelog = true, -- show the changelog after performing an update - auto_quit = false, -- automatically quit the current session after a successful update - remotes = { -- easily add new remotes to track - -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url - -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, - -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork - }, - }, - - -- Set colorscheme to use - colorscheme = "neosolarized", - - -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on - diagnostics = { - virtual_text = true, - underline = true, - }, - - lsp = { - mappings = { - n = { - -- I use gh/gj/gk/gl for window navigation; AstroNvim uses `gl`, but same as `ld`. - gl = false, - }, - }, - - -- customize lsp formatting options - formatting = { - -- control auto formatting on save - format_on_save = { - enabled = true, -- enable or disable format on save globally - allow_filetypes = { -- enable format on save for specified filetypes only - -- "go", - }, - ignore_filetypes = { -- disable format on save for specified filetypes - -- "python", - }, - }, - disabled = { -- disable formatting capabilities for the listed language servers - -- disable lua_ls formatting capability if you want to use StyLua to format your lua code - -- "lua_ls", - }, - timeout_ms = 25000, -- default format timeout - -- filter = function(client) -- fully override the default formatting function - -- return true - -- end - }, - -- enable servers that you already have installed without mason - servers = { - -- "pyright" - }, - }, - - -- Configure require("lazy").setup() options - lazy = { - defaults = { lazy = true }, - performance = { - rtp = { - -- customize default disabled vim plugins - disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" }, - }, - }, - }, - - -- This function is run last and is a good place to configuring - -- augroups/autocommands and custom filetypes also this just pure lua so - -- anything that doesn't fit in the normal config locations above can go here - polish = function() - -- Set up custom filetypes - -- vim.filetype.add { - -- extension = { - -- foo = "fooscript", - -- }, - -- filename = { - -- ["Foofile"] = "fooscript", - -- }, - -- pattern = { - -- ["~/%.config/foo/.*"] = "fooscript", - -- }, - -- } - end, -} diff --git a/config/nvim/lua/user/mappings.lua b/config/nvim/lua/user/mappings.lua deleted file mode 100644 index 67eb24f..0000000 --- a/config/nvim/lua/user/mappings.lua +++ /dev/null @@ -1,60 +0,0 @@ --- Mapping data with "desc" stored directly by vim.keymap.set(). --- --- Please use this mappings table to set keyboard mapping since this is the --- lower level configuration and more robust one. (which-key will --- automatically pick-up stored data by this setting.) - -vim.api.nvim_create_user_command("CopyCurBufAbsPathToClipboard", function() - local path = vim.fn.expand("%:p") - vim.fn.setreg("+", path) - vim.notify('Copied "' .. path .. '" to the clipboard!') -end, {}) -vim.api.nvim_create_user_command("CopyCurBufRelPathToClipboard", function() - local path = vim.fn.fnamemodify(vim.fn.expand("%"), ":.") - vim.fn.setreg("+", path) - vim.notify('Copied "' .. path .. '" to the clipboard!') -end, {}) - -return { - n = { - [""] = { "" }, - ["Q"] = { "gq" }, - - -- "Chordless" keys to move between windows - ["gj"] = { "j" }, - ["gk"] = { "k" }, - ["gh"] = { "h" }, - ["gl"] = { "l" }, - - -- Copy current filename to system clipboard - ["f"] = { "CopyCurBufRelPathToClipboard", desc = "Copy buffer rel. path to clipboard" }, - ["F"] = { "CopyCurBufAbsPathToClipboard", desc = "Copy buffer abs. path to clipboard" }, - - -- Move a line of text around with Alt+j/Alt+k - [""] = { "mz:m+`z" }, - [""] = { "mz:m-2`z" }, - - -- Toggle file explorer (tree-sitter) with current file focused - ["E"] = { "Neotree focus reveal", desc = "Toggle Explorer w/ file focused" }, - }, - v = { - [""] = { "gV" }, - - -- Move selected lines around with Alt+j/Alt+k - [""] = { ":m'>+`mzgv`yo`z" }, - [""] = { ":m'<-2`>my`"] = { "" }, - }, - i = { - [""] = { "`^" }, - - -- Some basic readline mappings in insert mode - [""] = { "" }, - [""] = { "" }, - [""] = { "" }, - }, - t = { - }, -} diff --git a/config/nvim/lua/user/options.lua b/config/nvim/lua/user/options.lua deleted file mode 100644 index ad91e83..0000000 --- a/config/nvim/lua/user/options.lua +++ /dev/null @@ -1,30 +0,0 @@ --- set vim options here (vim.. = value) -return { - opt = { - relativenumber = false, -- sets vim.opt.relativenumber - number = true, -- sets vim.opt.number - spell = false, -- sets vim.opt.spell - signcolumn = "auto", -- sets vim.opt.signcolumn to auto - wrap = false, -- sets vim.opt.wrap - guifont = "Inconsolata Nerd Font Mono", - textwidth = 100, - }, - g = { - mapleader = " ", -- sets vim.g.mapleader - autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled) - cmp_enabled = true, -- enable completion at start - autopairs_enabled = false, -- enable autopairs at start - diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on) - icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing) - ui_notifications_enabled = true, -- disable notifications when toggling UI elements - }, -} --- If you need more control, you can use the function()...end notation --- return function(local_vim) --- local_vim.opt.relativenumber = true --- local_vim.g.mapleader = " " --- local_vim.opt.whichwrap = vim.opt.whichwrap - { 'b', 's' } -- removing option from list --- local_vim.opt.shortmess = vim.opt.shortmess + { I = true } -- add to option list --- --- return local_vim --- end diff --git a/config/nvim/lua/user/plugins/community.lua b/config/nvim/lua/user/plugins/community.lua deleted file mode 100644 index 5d059e5..0000000 --- a/config/nvim/lua/user/plugins/community.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "AstroNvim/astrocommunity", - { import = "astrocommunity.completion.copilot-lua" }, - { import = "astrocommunity.colorscheme.neosolarized-nvim" }, -} diff --git a/config/nvim/lua/user/plugins/core.lua b/config/nvim/lua/user/plugins/core.lua deleted file mode 100644 index e730925..0000000 --- a/config/nvim/lua/user/plugins/core.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - { "max397574/better-escape.nvim", enabled = false }, - { "windwp/nvim-autopairs", enabled = false }, - { - "hrsh7th/nvim-cmp", - opts = function(_, opts) - -- I use Ctrl-Space at the OS level - opts.mapping[""] = nil - -- Unnecessary and potentially confusing - opts.mapping[""] = nil - -- Unnecessary and potentially confusing - opts.mapping[""] = nil - -- Incompatible with my using for - opts.mapping[""] = nil - opts.mapping[""] = nil - - return opts - end, - }, - { - "rcarriga/nvim-notify", - opts = { - background_colour = "#000000" - } - } -} diff --git a/config/nvim/neovim.yml b/config/nvim/neovim.yml new file mode 100644 index 0000000..b9235ab --- /dev/null +++ b/config/nvim/neovim.yml @@ -0,0 +1,6 @@ +--- +base: lua51 + +globals: + vim: + any: true diff --git a/config/nvim/selene.toml b/config/nvim/selene.toml new file mode 100644 index 0000000..e7005c3 --- /dev/null +++ b/config/nvim/selene.toml @@ -0,0 +1,8 @@ +std = "neovim" + +[rules] +global_usage = "allow" +if_same_then_else = "allow" +incorrect_standard_library_use = "allow" +mixed_table = "allow" +multiple_statements = "allow" -- 2.51.2