From a5518cff7471e17bdccaa7389ce4fb398ea0abc2 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Thu, 4 Apr 2024 15:23:10 -0300 Subject: [PATCH] neovim: move astronvim to 4.x --- flake.nix | 6 - programs/neovim/default.nix | 13 +- programs/neovim/init.lua | 19 +++ .../{user/plugins => lua}/community.lua | 11 +- programs/neovim/lua/lazy_setup.lua | 31 +++++ programs/neovim/lua/plugins/astrocore.lua | 79 +++++++++++ programs/neovim/lua/plugins/astrolsp.lua | 126 ++++++++++++++++++ programs/neovim/lua/plugins/astroui.lua | 37 +++++ .../neovim/{user => lua}/plugins/mason.lua | 4 +- .../null-ls.lua => lua/plugins/none-ls.lua} | 11 +- .../{user => lua}/plugins/treesitter.lua | 16 +-- programs/neovim/lua/plugins/user.lua | 81 +++++++++++ programs/neovim/lua/polish.lua | 39 ++++++ programs/neovim/user/.luacheckrc | 18 --- programs/neovim/user/.neoconf.json | 20 --- programs/neovim/user/.stylua.toml | 7 - programs/neovim/user/README.md | 36 ----- programs/neovim/user/highlights/duskfox.lua | 3 - programs/neovim/user/highlights/init.lua | 3 - programs/neovim/user/init.lua | 125 ----------------- programs/neovim/user/mappings.lua | 40 ------ programs/neovim/user/options.lua | 31 ----- programs/neovim/user/plugins/core.lua | 74 ---------- programs/neovim/user/plugins/user.lua | 13 -- 24 files changed, 438 insertions(+), 405 deletions(-) create mode 100644 programs/neovim/init.lua rename programs/neovim/{user/plugins => lua}/community.lua (84%) create mode 100644 programs/neovim/lua/lazy_setup.lua create mode 100644 programs/neovim/lua/plugins/astrocore.lua create mode 100644 programs/neovim/lua/plugins/astrolsp.lua create mode 100644 programs/neovim/lua/plugins/astroui.lua rename programs/neovim/{user => lua}/plugins/mason.lua (94%) rename programs/neovim/{user/plugins/null-ls.lua => lua/plugins/none-ls.lua} (61%) rename programs/neovim/{user => lua}/plugins/treesitter.lua (63%) create mode 100644 programs/neovim/lua/plugins/user.lua create mode 100644 programs/neovim/lua/polish.lua delete mode 100644 programs/neovim/user/.luacheckrc delete mode 100644 programs/neovim/user/.neoconf.json delete mode 100644 programs/neovim/user/.stylua.toml delete mode 100644 programs/neovim/user/README.md delete mode 100644 programs/neovim/user/highlights/duskfox.lua delete mode 100644 programs/neovim/user/highlights/init.lua delete mode 100644 programs/neovim/user/init.lua delete mode 100644 programs/neovim/user/mappings.lua delete mode 100644 programs/neovim/user/options.lua delete mode 100644 programs/neovim/user/plugins/core.lua delete mode 100644 programs/neovim/user/plugins/user.lua diff --git a/flake.nix b/flake.nix index e55e22a..f335df4 100644 --- a/flake.nix +++ b/flake.nix @@ -13,12 +13,6 @@ url = "github:hyprwm/Hyprland"; inputs.nixpkgs.follows = "nixpkgs"; }; - - # Neovim distribution - astronvim = { - url = "github:AstroNvim/AstroNvim"; - flake = false; - }; }; outputs = { self, home-manager, hyprland, nixpkgs, ... }@inputs: diff --git a/programs/neovim/default.nix b/programs/neovim/default.nix index 5006f5d..2ec5339 100644 --- a/programs/neovim/default.nix +++ b/programs/neovim/default.nix @@ -1,4 +1,4 @@ -{ pkgs, astronvim, lib, ... }: +{ pkgs, lib, ... }: { programs.neovim = { @@ -6,7 +6,7 @@ withNodeJs = true; withPython3 = true; - extraLuaConfig = builtins.readFile "${astronvim}/init.lua"; + extraLuaConfig = builtins.readFile ./init.lua; extraPackages = with pkgs; [ # CMAKE @@ -52,10 +52,9 @@ }; xdg.configFile = lib.mkMerge [ - { "nvim/lua/astronvim".source = "${astronvim}/lua/astronvim"; } - { "nvim/lua/plugins".source = "${astronvim}/lua/plugins"; } - { "nvim/lua/resession/extensions".source = "${astronvim}/lua/resession/extensions"; } - { "nvim/lua/lazy_snapshot.lua".source = "${astronvim}/lua/lazy_snapshot.lua"; } - { "nvim/lua/user".source = ./user; } + { "nvim/lua/community.lua".source = ./lua/community.lua; } + { "nvim/lua/lazy_setup.lua".source = ./lua/lazy_setup.lua; } + { "nvim/lua/plugins".source = ./lua/plugins; } + { "nvim/lua/polish.lua".source = ./lua/polish.lua; } ]; } diff --git a/programs/neovim/init.lua b/programs/neovim/init.lua new file mode 100644 index 0000000..2ce1cdd --- /dev/null +++ b/programs/neovim/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/programs/neovim/user/plugins/community.lua b/programs/neovim/lua/community.lua similarity index 84% rename from programs/neovim/user/plugins/community.lua rename to programs/neovim/lua/community.lua index 96b388b..949aa0d 100644 --- a/programs/neovim/user/plugins/community.lua +++ b/programs/neovim/lua/community.lua @@ -1,9 +1,10 @@ -return { - -- Add the community repository of plugin specifications - "AstroNvim/astrocommunity", - -- example of importing a plugin, comment out to use it or add your own - -- available plugins can be found at https://github.com/AstroNvim/astrocommunity +-- 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.colorscheme.catppuccin" }, { "catppuccin/nvim", diff --git a/programs/neovim/lua/lazy_setup.lua b/programs/neovim/lua/lazy_setup.lua new file mode 100644 index 0000000..3fb71f7 --- /dev/null +++ b/programs/neovim/lua/lazy_setup.lua @@ -0,0 +1,31 @@ +require("lazy").setup({ + { + "AstroNvim/AstroNvim", + --version = "^4", -- Remove version tracking to elect for nighly 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 + }, + }, + { import = "community" }, + { import = "plugins" }, +} --[[@as LazySpec]], { + -- Configure any other `lazy.nvim` configuration options here + install = { colorscheme = { "astrodark", "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/programs/neovim/lua/plugins/astrocore.lua b/programs/neovim/lua/plugins/astrocore.lua new file mode 100644 index 0000000..ee4b658 --- /dev/null +++ b/programs/neovim/lua/plugins/astrocore.lua @@ -0,0 +1,79 @@ +-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! +-- Configuration documentation can be found with `:h astrocore` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + -- Configure core features of AstroNvim + features = { + large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + autopairs = true, -- enable autopairs at start + cmp = true, -- enable completion at start + diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) + highlighturl = true, -- highlight URLs at start + notifications = true, -- enable notifications at start + }, + -- 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 = true, -- 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 + grepprg = "rg --vimgrep", -- use ripgrep on grep actions + }, + g = { -- vim.g. + -- configure global vim variables (vim.g) + -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` + -- This can be found in the `lua/lazy_setup.lua` file + }, + }, + -- 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 + n = { + -- second key is the lefthand side of the map + + -- navigate buffer tabs with `H` and `L` + -- L = { + -- function() require("astrocore.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end, + -- desc = "Next buffer", + -- }, + -- H = { + -- function() require("astrocore.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end, + -- desc = "Previous buffer", + -- }, + + -- mappings seen under group name "Buffer" + ["bD"] = { + function() + require("astroui.status.heirline").buffer_picker( + function(bufnr) require("astrocore.buffer").close(bufnr) end + ) + end, + desc = "Pick to close", + }, + -- 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" }, + -- quick save + -- [""] = { ":w!", desc = "Save File" }, -- change description but the same command + }, + t = { + -- setting a mapping to false will disable it + -- [""] = false, + }, + }, + }, +} diff --git a/programs/neovim/lua/plugins/astrolsp.lua b/programs/neovim/lua/plugins/astrolsp.lua new file mode 100644 index 0000000..a9b6680 --- /dev/null +++ b/programs/neovim/lua/plugins/astrolsp.lua @@ -0,0 +1,126 @@ +-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine +-- Configuration documentation can be found with `:h astrolsp` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + autoformat = true, -- enable or disable auto formatting on start + 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 + }, + -- 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", + "javascript", + "jsx", + "lua", + "nix", + "rust", + "tsx", + "typescript", + }, + 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 = 1000, -- 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" + "clangd", + "cmake", + "cssls", + "html", + "jsonls", + "lua_ls", + "marksman", + "nil_ls", + "rust_analyzer", + "taplo", + "tsserver", + "volar", + "yamlls", + }, + -- 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_document_highlight = { + -- 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/documentHighlight", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + { + -- events to trigger + event = { "CursorHold", "CursorHoldI" }, + -- the rest of the autocmd options (:h nvim_create_autocmd) + desc = "Document Highlighting", + callback = function() vim.lsp.buf.document_highlight() end, + }, + { + event = { "CursorMoved", "CursorMovedI", "BufLeave" }, + desc = "Document Highlighting Clear", + callback = function() vim.lsp.buf.clear_references() end, + }, + }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + gl = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, + -- 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.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end, + -- }, + }, + }, + -- 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/programs/neovim/lua/plugins/astroui.lua b/programs/neovim/lua/plugins/astroui.lua new file mode 100644 index 0000000..b061470 --- /dev/null +++ b/programs/neovim/lua/plugins/astroui.lua @@ -0,0 +1,37 @@ +-- AstroUI provides the basis for configuring the AstroNvim User Interface +-- Configuration documentation can be found with `:h astroui` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astroui", + ---@type AstroUIOpts + opts = { + -- change colorscheme + colorscheme = "catppuccin", + -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes + highlights = { + init = { -- this table overrides highlights in all themes + -- Normal = { bg = "#000000" }, + }, + astrotheme = { -- a table of overrides/changes when applying the astrotheme theme + -- Normal = { bg = "#000000" }, + }, + }, + -- Icons can be configured throughout the interface + icons = { + -- configure the loading of the lsp in the status line + LSPLoading1 = "⠋", + LSPLoading2 = "⠙", + LSPLoading3 = "⠹", + LSPLoading4 = "⠸", + LSPLoading5 = "⠼", + LSPLoading6 = "⠴", + LSPLoading7 = "⠦", + LSPLoading8 = "⠧", + LSPLoading9 = "⠇", + LSPLoading10 = "⠏", + }, + }, +} diff --git a/programs/neovim/user/plugins/mason.lua b/programs/neovim/lua/plugins/mason.lua similarity index 94% rename from programs/neovim/user/plugins/mason.lua rename to programs/neovim/lua/plugins/mason.lua index faa9a79..5a91b71 100644 --- a/programs/neovim/user/plugins/mason.lua +++ b/programs/neovim/lua/plugins/mason.lua @@ -1,4 +1,6 @@ --- customize mason plugins +-- Customize Mason plugins + +---@type LazySpec return { -- use mason-lspconfig to configure LSP installations { diff --git a/programs/neovim/user/plugins/null-ls.lua b/programs/neovim/lua/plugins/none-ls.lua similarity index 61% rename from programs/neovim/user/plugins/null-ls.lua rename to programs/neovim/lua/plugins/none-ls.lua index 9e850fd..2f432dd 100644 --- a/programs/neovim/user/plugins/null-ls.lua +++ b/programs/neovim/lua/plugins/none-ls.lua @@ -1,20 +1,23 @@ +-- Customize None-ls sources + +---@type LazySpec return { - "jose-elias-alvarez/null-ls.nvim", + "nvimtools/none-ls.nvim", opts = function(_, config) -- config 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/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting - -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + -- 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 config.sources = { -- Set a formatter -- null_ls.builtins.formatting.stylua, -- null_ls.builtins.formatting.prettier, null_ls.builtins.formatting.nixfmt, null_ls.builtins.formatting.prettier, - null_ls.builtins.formatting.rustfmt, null_ls.builtins.formatting.stylua, } + return config -- return final config table end, } diff --git a/programs/neovim/user/plugins/treesitter.lua b/programs/neovim/lua/plugins/treesitter.lua similarity index 63% rename from programs/neovim/user/plugins/treesitter.lua rename to programs/neovim/lua/plugins/treesitter.lua index 328c962..a3af93a 100644 --- a/programs/neovim/user/plugins/treesitter.lua +++ b/programs/neovim/lua/plugins/treesitter.lua @@ -1,19 +1,11 @@ +-- Customize Treesitter + +---@type LazySpec return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it - local utils = require "astronvim.utils" - opts.incremental_selection = { - enable = true, - keymaps = { - init_selection = "", -- Ctrl + Space - node_incremental = "", - scope_incremental = "", -- Alt + Space - node_decremental = "", -- Backspace - }, - } - opts.ignore_install = { "gotmpl" } - opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { -- Programming "c", "cmake", diff --git a/programs/neovim/lua/plugins/user.lua b/programs/neovim/lua/plugins/user.lua new file mode 100644 index 0000000..460751a --- /dev/null +++ b/programs/neovim/lua/plugins/user.lua @@ -0,0 +1,81 @@ +-- You can also add or configure plugins by creating files in this `plugins/` folder +-- Here are some examples: + +---@type LazySpec +return { + + -- == Examples of Adding Plugins == + + "andweeb/presence.nvim", + { + "ray-x/lsp_signature.nvim", + event = "BufRead", + config = function() require("lsp_signature").setup() end, + }, + + -- == Examples of Overriding Plugins == + + -- customize alpha options + { + "goolord/alpha-nvim", + opts = function(_, opts) + -- customize the dashboard header + opts.section.header.val = { + "⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⣰⠿⡇⢸⡟⡇⠀⠘⡷⠶⢶⣆⠘⣶⠶⠶⠶⣦⣤⣤⣤⣤⣄⣀⣀⣀⡀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠤⣤⡀⠀⠀", + "⠀⠀⠀⣰⣿⠀⠹⡌⣇⢹⣀⣠⣿⣦⠀⠹⣄⠸⣆⠀⣄⠹⡇⠀⠈⠃⠁⢹⢻⠀⣿⠈⢻⡛⢳⣤⣶⣿⣿⣿⣿⡶⠶⣶⣶⣶⣶⣶⣶⣶⣶⣾⡁⠀⢠⠴⠙⢦⡀", + "⠀⠀⣴⣿⡙⠀⠀⢳⣾⣿⣿⣿⣿⣿⣷⣦⣼⣿⣿⣷⡘⣆⠁⠀⠀⠀⢠⣼⣿⣴⠇⠀⠀⠙⢿⣿⣿⠟⢹⠃⠀⠀⣀⠀⠉⠈⢷⠈⢻⣿⠁⡿⢿⣄⡘⣄⠀⠀⠁", + "⠀⢸⠻⣿⠉⠓⣶⣶⣿⣿⣿⡿⠿⠿⢿⠿⣿⡉⠻⠇⠙⢿⣷⣀⠀⠀⢼⡙⠿⠃⠀⠀⠀⠀⠈⠿⠋⠀⢸⠄⠀⠀⠛⠃⠀⠀⢸⠀⠀⣿⢀⠇⢸⡿⠛⠛⢷⡶⠂", + "⠀⣸⡄⠙⣆⠀⣿⡿⠹⣏⡤⢤⣸⣿⠼⠀⠘⠇⠆⠀⠀⠀⠉⠉⢳⠦⣼⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⢀⡞⠀⣰⣿⣾⣀⣾⡅⠀⡞⠉⠙⢆", + "⢀⡿⢿⢦⠹⣿⣿⡇⠀⢉⠀⠈⠁⠀⠀⠀⢠⢃⡗⠀⠀⠀⠀⠀⢻⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠲⢤⣙⣲⣤⣤⣶⣫⠤⠖⠹⠋⠉⠉⠉⠻⣶⣽⣦⣀⡼", + "⠼⣧⣬⣿⡿⣭⠈⠿⣤⡬⠷⠴⠒⠒⠒⠲⠿⠛⠀⠂⠀⠂⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠛⠛⠉⠉⠉⠁⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠴⠶⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + } + return opts + end, + }, + + -- You can disable default plugins as follows: + { "max397574/better-escape.nvim", enabled = false }, + + -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call + { + "L3MON4D3/LuaSnip", + config = function(plugin, opts) + require "astronvim.plugins.configs.luasnip" (plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom luasnip configuration such as filetype extend or custom snippets + local luasnip = require "luasnip" + luasnip.filetype_extend("javascript", { "javascriptreact" }) + end, + }, + + { + "windwp/nvim-autopairs", + config = function(plugin, opts) + require "astronvim.plugins.configs.nvim-autopairs" (plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom autopairs configuration such as custom rules + local npairs = require "nvim-autopairs" + local Rule = require "nvim-autopairs.rule" + local cond = require "nvim-autopairs.conds" + npairs.add_rules( + { + Rule("$", "$", { "tex", "latex" }) + -- don't add a pair if the next character is % + :with_pair(cond.not_after_regex "%%") + -- don't add a pair if the previous character is xxx + :with_pair( + cond.not_before_regex("xxx", 3) + ) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex "xx") + -- disable adding a newline when you press + :with_cr(cond.none()), + }, + -- disable for .vim files, but it work for another filetypes + Rule("a", "a", "-vim") + ) + end, + }, +} diff --git a/programs/neovim/lua/polish.lua b/programs/neovim/lua/polish.lua new file mode 100644 index 0000000..b19c743 --- /dev/null +++ b/programs/neovim/lua/polish.lua @@ -0,0 +1,39 @@ +-- This will run last in the setup process and is a good place to configure +-- things like custom filetypes. This 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", + }, +} + + +local dap = require "dap" + +dap.adapters.codelldb = { + port = "${port}", + type = "server", + executable = { + command = "codelldb", + args = { "--port", "${port}" }, + }, +} + +dap.configurations.rust = { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + }, +} diff --git a/programs/neovim/user/.luacheckrc b/programs/neovim/user/.luacheckrc deleted file mode 100644 index d1113eb..0000000 --- a/programs/neovim/user/.luacheckrc +++ /dev/null @@ -1,18 +0,0 @@ --- Global objects -globals = { - "astronvim", - "astronvim_installation", - "vim", - "bit", -} - --- Rerun tests only if their modification time changed -cache = true - --- Don't report unused self arguments of methods -self = false - -ignore = { - "631", -- max_line_length - "212/_.*", -- unused argument, for vars with "_" prefix -} diff --git a/programs/neovim/user/.neoconf.json b/programs/neovim/user/.neoconf.json deleted file mode 100644 index 2d7a81f..0000000 --- a/programs/neovim/user/.neoconf.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - }, - "lspconfig": { - "lua_ls": { - "Lua.format.enable": false - } - } -} diff --git a/programs/neovim/user/.stylua.toml b/programs/neovim/user/.stylua.toml deleted file mode 100644 index bfcffff..0000000 --- a/programs/neovim/user/.stylua.toml +++ /dev/null @@ -1,7 +0,0 @@ -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/programs/neovim/user/README.md b/programs/neovim/user/README.md deleted file mode 100644 index e6c589a..0000000 --- a/programs/neovim/user/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# AstroNvim User Configuration Example - -A user configuration template for [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 -``` - -#### Clone AstroNvim - -```shell -git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim -``` - -#### 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/lua/user -``` - -#### Start Neovim - -```shell -nvim -``` diff --git a/programs/neovim/user/highlights/duskfox.lua b/programs/neovim/user/highlights/duskfox.lua deleted file mode 100644 index 31318ee..0000000 --- a/programs/neovim/user/highlights/duskfox.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { -- a table of overrides/changes to the duskfox theme - Normal = { bg = "#000000" }, -} diff --git a/programs/neovim/user/highlights/init.lua b/programs/neovim/user/highlights/init.lua deleted file mode 100644 index f7e055b..0000000 --- a/programs/neovim/user/highlights/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { -- this table overrides highlights in all themes - -- Normal = { bg = "#000000" }, -} diff --git a/programs/neovim/user/init.lua b/programs/neovim/user/init.lua deleted file mode 100644 index 1c3ec03..0000000 --- a/programs/neovim/user/init.lua +++ /dev/null @@ -1,125 +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 = "catppuccin", - - -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on - diagnostics = { - virtual_text = true, - underline = true, - }, - - lsp = { - -- 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", - "javascript", - "jsx", - "lua", - "nix", - "rust", - "tsx", - "typescript", - }, - 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 = 1000, -- 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 = { - "clangd", - "cmake", - "cssls", - "html", - "jsonls", - "lua_ls", - "marksman", - "nil_ls", - "rust_analyzer", - "taplo", - "tsserver", - "volar", - "yamlls", - }, - }, - - -- 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", - -- }, - -- } - local dap = require "dap" - - dap.adapters.codelldb = { - port = "${port}", - type = "server", - executable = { - command = "codelldb", - args = { "--port", "${port}" }, - }, - } - - dap.configurations.rust = { - { - name = "Launch file", - type = "codelldb", - request = "launch", - program = function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end, - cwd = "${workspaceFolder}", - stopOnEntry = false, - }, - } - end, -} diff --git a/programs/neovim/user/mappings.lua b/programs/neovim/user/mappings.lua deleted file mode 100644 index 8ac5c8f..0000000 --- a/programs/neovim/user/mappings.lua +++ /dev/null @@ -1,40 +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.) -return { - -- first key is the mode - n = { - -- second key is the lefthand side of the map - - -- navigate buffer tabs with `H` and `L` - -- L = { - -- function() require("astronvim.utils.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end, - -- desc = "Next buffer", - -- }, - -- H = { - -- function() require("astronvim.utils.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end, - -- desc = "Previous buffer", - -- }, - - -- mappings seen under group name "Buffer" - ["bD"] = { - function() - require("astronvim.utils.status").heirline.buffer_picker( - function(bufnr) require("astronvim.utils.buffer").close(bufnr) end - ) - end, - desc = "Pick to close", - }, - -- tables with the `name` key will be registered with which-key if it's installed - -- this is useful for naming menus - ["b"] = { name = "Buffers" }, - -- quick save - -- [""] = { ":w!", desc = "Save File" }, -- change description but the same command - }, - t = { - -- setting a mapping to false will disable it - -- [""] = false, - }, -} diff --git a/programs/neovim/user/options.lua b/programs/neovim/user/options.lua deleted file mode 100644 index 37b0b40..0000000 --- a/programs/neovim/user/options.lua +++ /dev/null @@ -1,31 +0,0 @@ --- set vim options here (vim.. = value) -return { - opt = { - -- set to true or false etc. - relativenumber = true, -- 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 - grepprg = "rg --vimgrep", -- use ripgrep on grep actions - }, - 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 = true, -- 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 - resession_enabled = false, -- enable experimental resession.nvim session management (will be default in AstroNvim v4) - }, -} --- 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/programs/neovim/user/plugins/core.lua b/programs/neovim/user/plugins/core.lua deleted file mode 100644 index b32ff09..0000000 --- a/programs/neovim/user/plugins/core.lua +++ /dev/null @@ -1,74 +0,0 @@ -return { - -- customize alpha options - { - "goolord/alpha-nvim", - opts = function(_, opts) - -- customize the dashboard header - opts.section.header.val = { - "⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⣰⠿⡇⢸⡟⡇⠀⠘⡷⠶⢶⣆⠘⣶⠶⠶⠶⣦⣤⣤⣤⣤⣄⣀⣀⣀⡀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠤⣤⡀⠀⠀", - "⠀⠀⠀⣰⣿⠀⠹⡌⣇⢹⣀⣠⣿⣦⠀⠹⣄⠸⣆⠀⣄⠹⡇⠀⠈⠃⠁⢹⢻⠀⣿⠈⢻⡛⢳⣤⣶⣿⣿⣿⣿⡶⠶⣶⣶⣶⣶⣶⣶⣶⣶⣾⡁⠀⢠⠴⠙⢦⡀", - "⠀⠀⣴⣿⡙⠀⠀⢳⣾⣿⣿⣿⣿⣿⣷⣦⣼⣿⣿⣷⡘⣆⠁⠀⠀⠀⢠⣼⣿⣴⠇⠀⠀⠙⢿⣿⣿⠟⢹⠃⠀⠀⣀⠀⠉⠈⢷⠈⢻⣿⠁⡿⢿⣄⡘⣄⠀⠀⠁", - "⠀⢸⠻⣿⠉⠓⣶⣶⣿⣿⣿⡿⠿⠿⢿⠿⣿⡉⠻⠇⠙⢿⣷⣀⠀⠀⢼⡙⠿⠃⠀⠀⠀⠀⠈⠿⠋⠀⢸⠄⠀⠀⠛⠃⠀⠀⢸⠀⠀⣿⢀⠇⢸⡿⠛⠛⢷⡶⠂", - "⠀⣸⡄⠙⣆⠀⣿⡿⠹⣏⡤⢤⣸⣿⠼⠀⠘⠇⠆⠀⠀⠀⠉⠉⢳⠦⣼⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⢀⡞⠀⣰⣿⣾⣀⣾⡅⠀⡞⠉⠙⢆", - "⢀⡿⢿⢦⠹⣿⣿⡇⠀⢉⠀⠈⠁⠀⠀⠀⢠⢃⡗⠀⠀⠀⠀⠀⢻⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠲⢤⣙⣲⣤⣤⣶⣫⠤⠖⠹⠋⠉⠉⠉⠻⣶⣽⣦⣀⡼", - "⠼⣧⣬⣿⡿⣭⠈⠿⣤⡬⠷⠴⠒⠒⠒⠲⠿⠛⠀⠂⠀⠂⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠛⠛⠉⠉⠉⠁⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠴⠶⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - } - end, - }, - -- You can disable default plugins as follows: - -- { "max397574/better-escape.nvim", enabled = false }, - -- - -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call - -- { - -- "L3MON4D3/LuaSnip", - -- config = function(plugin, opts) - -- require "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- add more custom luasnip configuration such as filetype extend or custom snippets - -- local luasnip = require "luasnip" - -- luasnip.filetype_extend("javascript", { "javascriptreact" }) - -- end, - -- }, - -- { - -- "windwp/nvim-autopairs", - -- config = function(plugin, opts) - -- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- add more custom autopairs configuration such as custom rules - -- local npairs = require "nvim-autopairs" - -- local Rule = require "nvim-autopairs.rule" - -- local cond = require "nvim-autopairs.conds" - -- npairs.add_rules( - -- { - -- Rule("$", "$", { "tex", "latex" }) - -- -- don't add a pair if the next character is % - -- :with_pair(cond.not_after_regex "%%") - -- -- don't add a pair if the previous character is xxx - -- :with_pair( - -- cond.not_before_regex("xxx", 3) - -- ) - -- -- don't move right when repeat character - -- :with_move(cond.none()) - -- -- don't delete if the next character is xx - -- :with_del(cond.not_after_regex "xx") - -- -- disable adding a newline when you press - -- :with_cr(cond.none()), - -- }, - -- -- disable for .vim files, but it work for another filetypes - -- Rule("a", "a", "-vim") - -- ) - -- end, - -- }, - -- By adding to the which-key config and using our helper function you can add more which-key registered bindings - -- { - -- "folke/which-key.nvim", - -- config = function(plugin, opts) - -- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- Add bindings which show up as group name - -- local wk = require "which-key" - -- wk.register({ - -- b = { name = "Buffer" }, - -- }, { mode = "n", prefix = "" }) - -- end, - -- }, -} diff --git a/programs/neovim/user/plugins/user.lua b/programs/neovim/user/plugins/user.lua deleted file mode 100644 index 22e89de..0000000 --- a/programs/neovim/user/plugins/user.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - -- You can also add new plugins here as well: - -- Add plugins, the lazy syntax - -- "andweeb/presence.nvim", - -- { - -- "ray-x/lsp_signature.nvim", - -- event = "BufRead", - -- config = function() - -- require("lsp_signature").setup() - -- end, - -- }, - { "folke/flash.nvim", vscode = false }, -}