From c5dcc7e24d2c7b4a4b47fe5402d7f2287386eaea Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 00:11:32 +0800 Subject: [PATCH 1/8] feat(home/base/tui/editors/neovim): upgrade astronvim to v4 --- .typos.toml | 1 + .../editors/neovim/astronvim_user/.gitignore | 2 - .../editors/neovim/astronvim_user/.nfnl.fnl | 1 - .../editors/neovim/astronvim_user/init.lua | 579 ------------------ .../neovim/astronvim_user/mappings.lua | 66 -- home/base/tui/editors/neovim/default.nix | 20 +- .../tui/editors/neovim/nvim/.neoconf.json | 20 + .../{astronvim_user => nvim}/.stylua.toml | 0 home/base/tui/editors/neovim/nvim/init.lua | 19 + .../tui/editors/neovim/nvim/lua/community.lua | 61 ++ .../editors/neovim/nvim/lua/lazy_setup.lua | 31 + .../neovim/nvim/lua/plugins/astrocore.lua | 179 ++++++ .../neovim/nvim/lua/plugins/astrolsp.lua | 154 +++++ .../neovim/nvim/lua/plugins/astroui.lua | 39 ++ .../neovim/nvim/lua/plugins/autosave.lua | 8 + .../neovim/nvim/lua/plugins/catppuccin.lua | 8 + .../neovim/nvim/lua/plugins/conjure.lua | 31 + .../neovim/nvim/lua/plugins/copilot.lua | 10 + .../editors/neovim/nvim/lua/plugins/flash.lua | 1 + .../neovim/nvim/lua/plugins/goto-preview.lua | 5 + .../nvim/lua/plugins/markdown-preview.lua | 12 + .../editors/neovim/nvim/lua/plugins/mason.lua | 64 ++ .../neovim/nvim/lua/plugins/neo-tree.lua | 13 + .../neovim/nvim/lua/plugins/neodev.lua | 2 + .../editors/neovim/nvim/lua/plugins/nfnl.lua | 1 + .../neovim/nvim/lua/plugins/none-ls.lua | 59 ++ .../neovim/nvim/lua/plugins/nvim-spectre.lua | 7 + .../neovim/nvim/lua/plugins/orgmode.lua | 26 + .../neovim/nvim/lua/plugins/panifer-rust.lua | 5 + .../neovim/nvim/lua/plugins/refactoring.lua | 8 + .../neovim/nvim/lua/plugins/sentiment.lua | 13 + .../neovim/nvim/lua/plugins/telescope.lua | 44 ++ .../neovim/nvim/lua/plugins/toggleterm.lua | 2 + .../neovim/nvim/lua/plugins/treesitter.lua | 62 ++ .../neovim/nvim/lua/plugins/treesj.lua | 10 + .../neovim/nvim/lua/plugins/undo-tree.lua | 2 + .../editors/neovim/nvim/lua/plugins/user.lua | 85 +++ .../editors/neovim/nvim/lua/plugins/yanky.lua | 62 ++ .../tui/editors/neovim/nvim/lua/polish.lua | 18 + home/base/tui/editors/neovim/nvim/neovim.yml | 6 + home/base/tui/editors/neovim/nvim/selene.toml | 8 + 41 files changed, 1081 insertions(+), 663 deletions(-) delete mode 100644 home/base/tui/editors/neovim/astronvim_user/.gitignore delete mode 100644 home/base/tui/editors/neovim/astronvim_user/.nfnl.fnl delete mode 100644 home/base/tui/editors/neovim/astronvim_user/init.lua delete mode 100644 home/base/tui/editors/neovim/astronvim_user/mappings.lua create mode 100644 home/base/tui/editors/neovim/nvim/.neoconf.json rename home/base/tui/editors/neovim/{astronvim_user => nvim}/.stylua.toml (100%) create mode 100644 home/base/tui/editors/neovim/nvim/init.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/community.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/autosave.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/catppuccin.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/conjure.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/copilot.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/flash.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/goto-preview.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/markdown-preview.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/neo-tree.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/neodev.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/nfnl.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/nvim-spectre.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/orgmode.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/panifer-rust.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/refactoring.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/sentiment.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/toggleterm.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/treesj.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/undo-tree.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/user.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/plugins/yanky.lua create mode 100644 home/base/tui/editors/neovim/nvim/lua/polish.lua create mode 100644 home/base/tui/editors/neovim/nvim/neovim.yml create mode 100644 home/base/tui/editors/neovim/nvim/selene.toml diff --git a/.typos.toml b/.typos.toml index 4407ba01..0594a8e1 100644 --- a/.typos.toml +++ b/.typos.toml @@ -9,4 +9,5 @@ binary = false extend-ignore-re = [ "iterm2", "iHgEIBYKACAWIQSizQe9ljFEyyclWmtVhZllwnQrSwUCZZ1T9wIdAAAKCRBVhZll", # crypto keys + "noice", # noice.nvim ] diff --git a/home/base/tui/editors/neovim/astronvim_user/.gitignore b/home/base/tui/editors/neovim/astronvim_user/.gitignore deleted file mode 100644 index d375789b..00000000 --- a/home/base/tui/editors/neovim/astronvim_user/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.clj-kondo/ -.nrepl-port diff --git a/home/base/tui/editors/neovim/astronvim_user/.nfnl.fnl b/home/base/tui/editors/neovim/astronvim_user/.nfnl.fnl deleted file mode 100644 index 4c80b735..00000000 --- a/home/base/tui/editors/neovim/astronvim_user/.nfnl.fnl +++ /dev/null @@ -1 +0,0 @@ -{:source-file-patterns ["*.fnl" "**/*.fnl"]} diff --git a/home/base/tui/editors/neovim/astronvim_user/init.lua b/home/base/tui/editors/neovim/astronvim_user/init.lua deleted file mode 100644 index 00c75d3a..00000000 --- a/home/base/tui/editors/neovim/astronvim_user/init.lua +++ /dev/null @@ -1,579 +0,0 @@ -return { - colorscheme = "catppuccin", - - options = { - opt = { - relativenumber = true, -- Show relative numberline - signcolumn = "auto", -- Show sign column when used only - spell = false, -- Spell checking - swapfile = false, -- Swapfile - smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4 - title = true, -- Set the title of window to `filename [+=-] (path) - NVIM` - -- The percentage of 'columns' to use for the title - -- When the title is longer, only the end of the path name is shown. - titlelen = 20, - }, - }, - - plugins = { - "AstroNvim/astrocommunity", - -- Motion - { import = "astrocommunity.motion.mini-surround" }, - -- https://github.com/echasnovski/mini.ai - { import = "astrocommunity.motion.mini-ai" }, - { import = "astrocommunity.motion.flash-nvim" }, - -- disable toggleterm.nvim, zellij's terminal is far better than neovim's one - { "akinsho/toggleterm.nvim", enabled = false }, - { "folke/flash.nvim", vscode = false }, - -- Highly experimental plugin that completely replaces - -- the UI for messages, cmdline and the popupmenu. - -- { import = "astrocommunity.utility.noice-nvim" }, - -- Fully featured & enhanced replacement for copilot.vim - -- work with both auto completion in cmp and copilot - { import = "astrocommunity.media.vim-wakatime" }, - { import = "astrocommunity.motion.leap-nvim" }, - { import = "astrocommunity.motion.flit-nvim" }, - { import = "astrocommunity.scrolling.nvim-scrollbar" }, - { import = "astrocommunity.editing-support.todo-comments-nvim" }, - -- Language Support - ---- Frontend & NodeJS - { import = "astrocommunity.pack.typescript-all-in-one" }, - { import = "astrocommunity.pack.tailwindcss" }, - { import = "astrocommunity.pack.html-css" }, - { import = "astrocommunity.pack.prisma" }, - { import = "astrocommunity.pack.vue" }, - ---- Configuration Language - { import = "astrocommunity.pack.markdown" }, - { import = "astrocommunity.pack.json" }, - { import = "astrocommunity.pack.yaml" }, - { import = "astrocommunity.pack.toml" }, - ---- Backend / System - { import = "astrocommunity.pack.lua" }, - { import = "astrocommunity.pack.go" }, - { import = "astrocommunity.pack.rust" }, - { import = "astrocommunity.pack.python" }, - { import = "astrocommunity.pack.java" }, - { import = "astrocommunity.pack.cmake" }, - { import = "astrocommunity.pack.cpp" }, - -- { import = "astrocommunity.pack.nix" }, -- manually add config for nix, comment this one. - { import = "astrocommunity.pack.proto" }, - - ---- Operation & Cloud Native - { import = "astrocommunity.pack.terraform" }, - { import = "astrocommunity.pack.bash" }, - { import = "astrocommunity.pack.docker" }, - { import = "astrocommunity.pack.helm" }, - - -- colorscheme - { import = "astrocommunity.colorscheme.catppuccin" }, - { - "catppuccin/nvim", - name = "catppuccin", - opts = function(_, opts) - opts.flavour = "mocha" -- latte, frappe, macchiato, mocha - opts.transparent_background = true -- setting the background color. - end, - }, - -- Language Parser for syntax highlighting / indentation / folding / Incremental selection - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - 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, { - -- neovim - "vim", - "lua", - -- operation & cloud native - "dockerfile", - "hcl", - "jsonnet", - "regex", - "terraform", - "nix", - "csv", - -- other programming language - "diff", - "gitignore", - "gitcommit", - "latex", - "sql", - -- Lisp like - "fennel", - "clojure", - "commonlisp", - -- customized languages: - "scheme", - }) - - -- add support for scheme - local parser_config = require("nvim-treesitter.parsers").get_parser_configs() - parser_config.scheme = { - install_info = { - url = "https://github.com/6cdh/tree-sitter-scheme", -- local path or git repo - files = { "src/parser.c" }, - -- optional entries: - branch = "main", -- default branch in case of git repo if different from master - generate_requires_npm = false, -- if stand-alone parser without npm dependencies - requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c - }, - } - -- use scheme parser for filetypes: scm - vim.treesitter.language.register("scheme", "scm") - end, - }, - { - "eraserhd/parinfer-rust", - build = "cargo build --release", - ft = { "scm", "scheme" }, - }, - { "Olical/nfnl", ft = "fennel" }, - { - "Olical/conjure", - ft = { "clojure", "fennel", "python", "scheme" }, -- etc - -- [Optional] cmp-conjure for cmp - dependencies = { - { - "PaterJason/cmp-conjure", - config = function() - local cmp = require("cmp") - local config = cmp.get_config() - table.insert(config.sources, { - name = "buffer", - option = { - sources = { - { name = "conjure" }, - }, - }, - }) - cmp.setup(config) - end, - }, - }, - config = function(_, opts) - require("conjure.main").main() - require("conjure.mapping")["on-filetype"]() - end, - init = function() - -- Set configuration options here - vim.g["conjure#debug"] = true - end, - }, - { - "nvim-orgmode/orgmode", - dependencies = { - { "nvim-treesitter/nvim-treesitter", lazy = true }, - }, - event = "VeryLazy", - config = function() - -- Load treesitter grammar for org - require("orgmode").setup_ts_grammar() - - -- Setup treesitter - require("nvim-treesitter.configs").setup({ - highlight = { - enable = true, - additional_vim_regex_highlighting = { "org" }, - }, - ensure_installed = { "org" }, - }) - - -- Setup orgmode - require("orgmode").setup({ - org_agenda_files = "~/org/**/*", - org_default_notes_file = "~/org/refile.org", - }) - end, - }, - - -- Lua implementation of CamelCaseMotion, with extra consideration of punctuation. - { import = "astrocommunity.motion.nvim-spider" }, - -- AI Assistant - { import = "astrocommunity.completion.copilot-lua-cmp" }, - -- Custom copilot-lua to enable filetypes: markdown - { - "zbirenbaum/copilot.lua", - opts = function(_, opts) - opts.filetypes = { - yaml = true, - markdown = true, - } - end, - }, - - { - "0x00-ketsu/autosave.nvim", - -- lazy-loading on events - event = { "InsertLeave", "TextChanged" }, - opts = function(_, opts) - opts.prompt_style = "stdout" -- notify or stdout - end, - }, - - -- markdown preview - { - "0x00-ketsu/markdown-preview.nvim", - ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" }, - config = function() - require("markdown-preview").setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the setup section below - }) - end, - }, - - -- clipboard manager - { - "gbprod/yanky.nvim", - opts = function() - local mapping = require("yanky.telescope.mapping") - local mappings = mapping.get_defaults() - mappings.i[""] = nil - return { - highlight = { timer = 200 }, - picker = { - telescope = { - use_default_mappings = false, - mappings = mappings, - }, - }, - } - end, - keys = { - { - "y", - "(YankyYank)", - mode = { "n", "x" }, - desc = "Yank text", - }, - { - "p", - "(YankyPutAfter)", - mode = { "n", "x" }, - desc = "Put yanked text after cursor", - }, - { - "P", - "(YankyPutBefore)", - mode = { "n", "x" }, - desc = "Put yanked text before cursor", - }, - { - "gp", - "(YankyGPutAfter)", - mode = { "n", "x" }, - desc = "Put yanked text after selection", - }, - { - "gP", - "(YankyGPutBefore)", - mode = { "n", "x" }, - desc = "Put yanked text before selection", - }, - { "[y", "(YankyCycleForward)", desc = "Cycle forward through yank history" }, - { "]y", "(YankyCycleBackward)", desc = "Cycle backward through yank history" }, - { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, - { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, - { "]P", "(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, - { "[P", "(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, - { ">p", "(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" }, - { "(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" }, - { ">P", "(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" }, - { "(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" }, - { "=p", "(YankyPutAfterFilter)", desc = "Put after applying a filter" }, - { "=P", "(YankyPutBeforeFilter)", desc = "Put before applying a filter" }, - }, - }, - - -- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair. - { - "utilyre/sentiment.nvim", - version = "*", - event = "VeryLazy", -- keep for lazy loading - opts = { - -- config - }, - init = function() - -- `matchparen.vim` needs to be disabled manually in case of lazy loading - vim.g.loaded_matchparen = 1 - end, - }, - - -- joining blocks of code into oneline, or splitting one line into multiple lines. - { - "Wansmer/treesj", - keys = { "m", "j", "s" }, - dependencies = { "nvim-treesitter/nvim-treesitter" }, - config = function() - require("treesj").setup({ --[[ your config ]] - }) - end, - }, - - -- File explorer(Custom configs) - { - "nvim-neo-tree/neo-tree.nvim", - opts = { - filesystem = { - filtered_items = { - visible = true, -- visible by default - hide_dotfiles = false, - hide_gitignored = false, - }, - }, - }, - }, - -- The plugin offers the alibity to refactor code. - { - "ThePrimeagen/refactoring.nvim", - dependencies = { - { "nvim-lua/plenary.nvim" }, - { "nvim-treesitter/nvim-treesitter" }, - }, - }, - -- The plugin offers the abilibty to search and replace. - { - "nvim-pack/nvim-spectre", - dependencies = { - { "nvim-lua/plenary.nvim" }, - }, - }, - - -- full signature help, docs and completion for the nvim lua API. - { "folke/neodev.nvim", opts = {} }, - -- automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching. - { "RRethy/vim-illuminate", config = function() end }, - -- implementation/definition preview - { - "rmagatti/goto-preview", - config = function() - require("goto-preview").setup({}) - end, - }, - - -- Undo tree - { "debugloop/telescope-undo.nvim" }, - - -- Install lsp, formmatter and others via home manager instead of Mason.nvim - -- LSP installations - { - "williamboman/mason-lspconfig.nvim", - -- mason is unusable on NixOS, disable it. - -- ensure_installed nothing - opts = function(_, opts) - opts.ensure_installed = nil - opts.automatic_installation = false - end, - }, - -- Formatters/Linter installation - { - "jay-babu/mason-null-ls.nvim", - -- mason is unusable on NixOS, disable it. - -- ensure_installed nothing - opts = function(_, opts) - opts.ensure_installed = nil - opts.automatic_installation = false - end, - }, - -- Debugger installation - { - "jay-babu/mason-nvim-dap.nvim", - -- mason is unusable on NixOS, disable it. - -- ensure_installed nothing - opts = function(_, opts) - opts.ensure_installed = nil - opts.automatic_installation = false - end, - }, - - { - "jose-elias-alvarez/null-ls.nvim", - opts = function(_, opts) - local null_ls = require("null-ls") - local code_actions = null_ls.builtins.code_actions - local diagnostics = null_ls.builtins.diagnostics - local formatting = null_ls.builtins.formatting - local hover = null_ls.builtins.hover - local completion = null_ls.builtins.completion - -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md - if type(opts.sources) == "table" then - vim.list_extend(opts.sources, { - -- Common Code Actions - code_actions.gitsigns, - -- common refactoring actions based off the Refactoring book by Martin Fowler - code_actions.refactoring, - code_actions.gomodifytags, -- Go - modify struct field tags - code_actions.impl, -- Go - generate interface method stubs - code_actions.shellcheck, - code_actions.proselint, -- English prose linter - code_actions.statix, -- Lints and suggestions for Nix. - - -- Diagnostic - diagnostics.actionlint, -- GitHub Actions workflow syntax checking - diagnostics.buf, -- check text in current buffer - diagnostics.checkmake, -- check Makefiles - diagnostics.deadnix, -- Scan Nix files for dead code. - - -- Formatting - formatting.prettier, -- js/ts/vue/css/html/json/... formatter - diagnostics.hadolint, -- Dockerfile linter - formatting.black, -- Python formatter - formatting.ruff, -- extremely fast Python linter - formatting.goimports, -- Go formatter - formatting.shfmt, -- Shell formatter - formatting.rustfmt, -- Rust formatter - formatting.taplo, -- TOML formatteautoindentr - formatting.terraform_fmt, -- Terraform formatter - formatting.stylua, -- Lua formatter - formatting.alejandra, -- Nix formatter - formatting.sqlfluff.with({ -- SQL formatter - extra_args = { "--dialect", "postgres" }, -- change to your dialect - }), - formatting.nginx_beautifier, -- Nginx formatter - formatting.verible_verilog_format, -- Verilog formatter - formatting.emacs_scheme_mode, -- using emacs in batch mode to format scheme files. - formatting.fnlfmt, -- Format Fennel code - }) - end - end, - }, - - { - "nvim-telescope/telescope.nvim", - branch = "0.1.x", - dependencies = { "nvim-lua/plenary.nvim" }, - init = function() - -- 1. Disable highlighting for certain filetypes - -- 2. Ignore files larger than a certain filesize - local previewers = require("telescope.previewers") - - local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array - local filesize_threshold = 300 * 1024 -- 300KB - local bad_files = function(filepath) - for _, v in ipairs(_bad) do - if filepath:match(v) then - return false - end - end - return true - end - - local new_maker = function(filepath, bufnr, opts) - opts = opts or {} - if opts.use_ft_detect == nil then - opts.use_ft_detect = true - end - - -- 1. Check if the file is in the bad_files array, and if so, don't highlight it - opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath) - - -- 2. Check the file size, and ignore it if it's too big(preview nothing). - filepath = vim.fn.expand(filepath) - vim.loop.fs_stat(filepath, function(_, stat) - if not stat then - return - end - if stat.size > filesize_threshold then - return - else - previewers.buffer_previewer_maker(filepath, bufnr, opts) - end - end) - end - - require("telescope").setup({ - defaults = { - buffer_previewer_maker = new_maker, - }, - }) - end, - }, - }, - - -- Configure require("lazy").setup() options - lazy = { - defaults = { lazy = true }, - performance = { - rtp = { - -- customize default disabled vim plugins - disabled_plugins = {}, - }, - }, - }, - - -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md - lsp = { - config = { - -- the offset_encoding of clangd will confilicts whit null-ls - -- so we need to manually set it to utf-8 - clangd = { - capabilities = { - offsetEncoding = "utf-8", - }, - }, - scheme_langserver = { - filetypes = { "scheme", "scm" }, - single_file_support = true, - }, - }, - -- enable servers that installed by home-manager instead of mason - servers = { - ---- Frontend & NodeJS - "tsserver", -- typescript/javascript language server - "tailwindcss", -- tailwindcss language server - "html", -- html language server - "cssls", -- css language server - "prismals", -- prisma language server - "volar", -- vue language server - ---- Configuration Language - "marksman", -- markdown ls - "jsonls", -- json language server - "yamlls", -- yaml language server - "taplo", -- toml language server - ---- Backend - "lua_ls", -- lua - "gopls", -- go - "rust_analyzer", -- rust - "pyright", -- python - "ruff_lsp", -- extremely fast Python linter and code transformation - "jdtls", -- java - "nil_ls", -- nix language server - "bufls", -- protocol buffer language server - "zls", -- zig language server - ---- HDL - "verible", -- verilog language server - ---- Operation & Cloud Nativautoindente - "bashls", -- bash - "cmake", -- cmake language server - "clangd", -- c/c++ - "dockerls", -- dockerfile - "jsonnet_ls", -- jsonnet language server - "terraformls", -- terraform hcl - "nushell", -- nushell language server - "scheme_langserver", -- scheme language server - }, - formatting = { - disabled = {}, - format_on_save = { - enabled = true, - allow_filetypes = { - "go", - "jsonnet", - "rust", - "terraform", - "nu", - }, - }, - }, - }, -} diff --git a/home/base/tui/editors/neovim/astronvim_user/mappings.lua b/home/base/tui/editors/neovim/astronvim_user/mappings.lua deleted file mode 100644 index 7ceb5931..00000000 --- a/home/base/tui/editors/neovim/astronvim_user/mappings.lua +++ /dev/null @@ -1,66 +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.) -local utils = require "astronvim.utils" - -require("telescope").load_extension("refactoring") -require("telescope").load_extension("yank_history") -require("telescope").load_extension("undo") - -return { - -- normal mode - n = { - -- second key is the lefthand side of the map - -- mappings seen under group name "Buffer" - ["bn"] = { "tabnew", desc = "New tab" }, - -- quick save - [""] = { ":w!", desc = "Save File" }, -- change description but the same command - - -- Terminal - -- NOTE: https://neovim.io/doc/user/builtin.html#jobstart() - -- 1. If {cmd} is a List it runs directly (no 'shell') - -- 2. If {cmd} is a String it runs in the 'shell' - -- search and replace globally - ['ss'] = {'lua require("spectre").toggle()', desc = "Toggle Spectre" }, - ['sw'] = {'lua require("spectre").open_visual({select_word=true})', desc = "Search current word" }, - ['sp'] ={'lua require("spectre").open_file_search({select_word=true})', desc = "Search on current file" }, - - -- refactoring - ["ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" }, - ["rb"] = { function() require('refactoring').refactor('Extract Block') end, desc = "Extract Block" }, - ["rbf"] = { function() require('refactoring').refactor('Extract Block To File') end, desc = "Extract Block To File" }, - ["rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" }, - ["rp"] = { function() require('refactoring').debug.printf({below = false}) end, desc = "Insert print statement to mark the calling of a function" }, - ["rv"] = { function() require('refactoring').debug.print_var() end, desc = "Insert print statement to print a variable" }, - ["rc"] = { function() require('refactoring').debug.cleanup({}) end, desc = "Cleanup of all generated print statements" }, - - -- yank_history - ["yh"] = { function() require("telescope").extensions.yank_history.yank_history() end, desc = "Preview Yank History" }, - - -- undo history - ["uh"] = {"Telescope undo", desc="Telescope undo" }, - - -- implementation/definition preview - ["gpd"] = { "lua require('goto-preview').goto_preview_definition()", desc="goto_preview_definition" }, - ["gpt"] = { "lua require('goto-preview').goto_preview_type_definition()", desc="goto_preview_type_definition" }, - ["gpi"] = { "lua require('goto-preview').goto_preview_implementation()", desc="goto_preview_implementation" }, - ["gP" ] = { "lua require('goto-preview').close_all_win()", desc="close_all_win" }, - ["gpr"] = { "lua require('goto-preview').goto_preview_references()", desc="goto_preview_references" }, - }, - -- Visual mode - v = { - -- search and replace globally - ['sw'] = {'lua require("spectre").open_visual()', desc = "Search current word" }, - }, - -- visual mode(what's the difference between v and x???) - x = { - -- refactoring - ["ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" }, - ["re"] = { function() require('refactoring').refactor('Extract Function') end, desc = "Extracts the selected code to a separate function" }, - ["rf"] = { function() require('refactoring').refactor('Extract Function To File') end, desc = "Extract Function To File" }, - ["rv"] = { function() require('refactoring').refactor('Extract Variable') end, desc = "Extracts occurrences of a selected expression to its own variable" }, - ["rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" }, - }, -} diff --git a/home/base/tui/editors/neovim/default.nix b/home/base/tui/editors/neovim/default.nix index ee31425d..5e5353b2 100644 --- a/home/base/tui/editors/neovim/default.nix +++ b/home/base/tui/editors/neovim/default.nix @@ -1,6 +1,7 @@ { + config, + lib, pkgs, - astronvim, ... }: ############################################################################### @@ -14,20 +15,9 @@ let vdiff = "nvim -d"; }; in { - xdg.configFile = { - # astronvim's config - "nvim" = { - source = astronvim; - force = true; - }; - - # my custom astronvim config, astronvim will load it after base config - # https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16 - "astronvim/lua/user" = { - source = ./astronvim_user; - force = true; - }; - }; + home.activation.installAstroNvim = lib.hm.dag.entryAfter ["writeBoundary"] '' + ${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${./nvim}/ ${config.xdg.configHome}/nvim/ + ''; home.shellAliases = shellAliases; programs.nushell.shellAliases = shellAliases; diff --git a/home/base/tui/editors/neovim/nvim/.neoconf.json b/home/base/tui/editors/neovim/nvim/.neoconf.json new file mode 100644 index 00000000..2d7a81f9 --- /dev/null +++ b/home/base/tui/editors/neovim/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/home/base/tui/editors/neovim/astronvim_user/.stylua.toml b/home/base/tui/editors/neovim/nvim/.stylua.toml similarity index 100% rename from home/base/tui/editors/neovim/astronvim_user/.stylua.toml rename to home/base/tui/editors/neovim/nvim/.stylua.toml diff --git a/home/base/tui/editors/neovim/nvim/init.lua b/home/base/tui/editors/neovim/nvim/init.lua new file mode 100644 index 00000000..2ce1cdd2 --- /dev/null +++ b/home/base/tui/editors/neovim/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/home/base/tui/editors/neovim/nvim/lua/community.lua b/home/base/tui/editors/neovim/nvim/lua/community.lua new file mode 100644 index 00000000..a80d0491 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/community.lua @@ -0,0 +1,61 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- 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", + -- Motion + { import = "astrocommunity.motion.mini-surround" }, + -- https://github.com/echasnovski/mini.ai + { import = "astrocommunity.motion.mini-ai" }, + { import = "astrocommunity.motion.flash-nvim" }, + -- Highly experimental plugin that completely replaces + -- the UI for messages, cmdline and the popupmenu. + -- { import = "astrocommunity.utility.noice-nvim" }, + -- Fully featured & enhanced replacement for copilot.vim + -- work with both auto completion in cmp and copilot + { import = "astrocommunity.media.vim-wakatime" }, + { import = "astrocommunity.motion.leap-nvim" }, + { import = "astrocommunity.motion.flit-nvim" }, + { import = "astrocommunity.scrolling.nvim-scrollbar" }, + { import = "astrocommunity.editing-support.todo-comments-nvim" }, + -- Language Support + ---- Frontend & NodeJS + { import = "astrocommunity.pack.typescript-all-in-one" }, + { import = "astrocommunity.pack.tailwindcss" }, + { import = "astrocommunity.pack.html-css" }, + { import = "astrocommunity.pack.prisma" }, + { import = "astrocommunity.pack.vue" }, + ---- Configuration Language + { import = "astrocommunity.pack.markdown" }, + { import = "astrocommunity.pack.json" }, + { import = "astrocommunity.pack.yaml" }, + { import = "astrocommunity.pack.toml" }, + ---- Backend / System + { import = "astrocommunity.pack.lua" }, + { import = "astrocommunity.pack.go" }, + { import = "astrocommunity.pack.rust" }, + { import = "astrocommunity.pack.python" }, + { import = "astrocommunity.pack.java" }, + { import = "astrocommunity.pack.cmake" }, + { import = "astrocommunity.pack.cpp" }, + -- { import = "astrocommunity.pack.nix" }, -- manually add config for nix, comment this one. + { import = "astrocommunity.pack.proto" }, + + ---- Operation & Cloud Native + { import = "astrocommunity.pack.terraform" }, + { import = "astrocommunity.pack.bash" }, + { import = "astrocommunity.pack.docker" }, + { import = "astrocommunity.pack.helm" }, + + -- colorscheme + { import = "astrocommunity.colorscheme.catppuccin" }, + + -- Lua implementation of CamelCaseMotion, with extra consideration of punctuation. + { import = "astrocommunity.motion.nvim-spider" }, + -- AI Assistant + { import = "astrocommunity.completion.copilot-lua-cmp" }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua b/home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua new file mode 100644 index 00000000..7985342b --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/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 = { "catppuccin"}, }, + 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/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua new file mode 100644 index 00000000..3bb22e4b --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua @@ -0,0 +1,179 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- 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 + +require("telescope").load_extension "refactoring" +require("telescope").load_extension "yank_history" +require("telescope").load_extension "undo" + +---@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, -- Show relative numberline + signcolumn = "auto", -- Show sign column when used only + spell = false, -- Spell checking + swapfile = false, -- Swapfile + smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4 + title = true, -- Set the title of window to `filename [+=-] (path) - NVIM` + -- The percentage of 'columns' to use for the title + -- When the title is longer, only the end of the path name is shown. + titlelen = 20, + }, + 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.count1) end, desc = "Next buffer" }, + H = { function() require("astrocore.buffer").nav(-vim.v.count1) 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" }, + + -- second key is the lefthand side of the map + -- mappings seen under group name "Buffer" + ["bn"] = { "tabnew", desc = "New tab" }, + -- quick save + [""] = { ":w!", desc = "Save File" }, -- change description but the same command + + -- Terminal + -- NOTE: https://neovim.io/doc/user/builtin.html#jobstart() + -- 1. If {cmd} is a List it runs directly (no 'shell') + -- 2. If {cmd} is a String it runs in the 'shell' + -- search and replace globally + ["ss"] = { 'lua require("spectre").toggle()', desc = "Toggle Spectre" }, + ["sw"] = { + 'lua require("spectre").open_visual({select_word=true})', + desc = "Search current word", + }, + ["sp"] = { + 'lua require("spectre").open_file_search({select_word=true})', + desc = "Search on current file", + }, + + -- refactoring + ["ri"] = { + function() require("refactoring").refactor "Inline Variable" end, + desc = "Inverse of extract variable", + }, + ["rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" }, + ["rbf"] = { + function() require("refactoring").refactor "Extract Block To File" end, + desc = "Extract Block To File", + }, + ["rr"] = { + function() require("telescope").extensions.refactoring.refactors() end, + desc = "Prompt for a refactor to apply", + }, + ["rp"] = { + function() require("refactoring").debug.printf { below = false } end, + desc = "Insert print statement to mark the calling of a function", + }, + ["rv"] = { + function() require("refactoring").debug.print_var() end, + desc = "Insert print statement to print a variable", + }, + ["rc"] = { + function() require("refactoring").debug.cleanup {} end, + desc = "Cleanup of all generated print statements", + }, + + -- yank_history + ["yh"] = { + function() require("telescope").extensions.yank_history.yank_history() end, + desc = "Preview Yank History", + }, + + -- undo history + ["uh"] = { "Telescope undo", desc = "Telescope undo" }, + + -- implementation/definition preview + ["gpd"] = { "lua require('goto-preview').goto_preview_definition()", desc = "goto_preview_definition" }, + ["gpt"] = { + "lua require('goto-preview').goto_preview_type_definition()", + desc = "goto_preview_type_definition", + }, + ["gpi"] = { + "lua require('goto-preview').goto_preview_implementation()", + desc = "goto_preview_implementation", + }, + ["gP"] = { "lua require('goto-preview').close_all_win()", desc = "close_all_win" }, + ["gpr"] = { "lua require('goto-preview').goto_preview_references()", desc = "goto_preview_references" }, + }, + t = { + -- setting a mapping to false will disable it + -- [""] = false, + }, + -- Visual mode + v = { + -- search and replace globally + ["sw"] = { 'lua require("spectre").open_visual()', desc = "Search current word" }, + }, + -- visual mode(what's the difference between v and x???) + x = { + -- refactoring + ["ri"] = { + function() require("refactoring").refactor "Inline Variable" end, + desc = "Inverse of extract variable", + }, + ["re"] = { + function() require("refactoring").refactor "Extract Function" end, + desc = "Extracts the selected code to a separate function", + }, + ["rf"] = { + function() require("refactoring").refactor "Extract Function To File" end, + desc = "Extract Function To File", + }, + ["rv"] = { + function() require("refactoring").refactor "Extract Variable" end, + desc = "Extracts occurrences of a selected expression to its own variable", + }, + ["rr"] = { + function() require("telescope").extensions.refactoring.refactors() end, + desc = "Prompt for a refactor to apply", + }, + }, + }, + }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua new file mode 100644 index 00000000..ad5efa6d --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua @@ -0,0 +1,154 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- 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", + "jsonnet", + "rust", + "terraform", + "nu", + }, + 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 = { + ---- Frontend & NodeJS + "tsserver", -- typescript/javascript language server + "tailwindcss", -- tailwindcss language server + "html", -- html language server + "cssls", -- css language server + "prismals", -- prisma language server + "volar", -- vue language server + ---- Configuration Language + "marksman", -- markdown ls + "jsonls", -- json language server + "yamlls", -- yaml language server + "taplo", -- toml language server + ---- Backend + "lua_ls", -- lua + "gopls", -- go + "rust_analyzer", -- rust + "pyright", -- python + "ruff_lsp", -- extremely fast Python linter and code transformation + "jdtls", -- java + "nil_ls", -- nix language server + "bufls", -- protocol buffer language server + "zls", -- zig language server + ---- HDL + "verible", -- verilog language server + ---- Operation & Cloud Nativautoindente + "bashls", -- bash + "cmake", -- cmake language server + "clangd", -- c/c++ + "dockerls", -- dockerfile + "jsonnet_ls", -- jsonnet language server + "terraformls", -- terraform hcl + "nushell", -- nushell language server + "scheme_langserver", -- scheme language server + }, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + -- the offset_encoding of clangd will confilicts whit null-ls + -- so we need to manually set it to utf-8 + clangd = { + capabilities = { + offsetEncoding = "utf-8", + }, + }, + scheme_langserver = { + filetypes = { "scheme", "scm" }, + single_file_support = true, + }, + }, + -- 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/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua new file mode 100644 index 00000000..2080aa98 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua @@ -0,0 +1,39 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- 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 = "astrodark", + -- 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/home/base/tui/editors/neovim/nvim/lua/plugins/autosave.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/autosave.lua new file mode 100644 index 00000000..026ba4ad --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/autosave.lua @@ -0,0 +1,8 @@ +return { + "0x00-ketsu/autosave.nvim", + -- lazy-loading on events + event = { "InsertLeave", "TextChanged" }, + opts = function(_, opts) + opts.prompt_style = "stdout" -- notify or stdout + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/catppuccin.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 00000000..7279434a --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,8 @@ +return { + "catppuccin/nvim", + name = "catppuccin", + opts = function(_, opts) + opts.flavour = "mocha" -- latte, frappe, macchiato, mocha + opts.transparent_background = true -- setting the background color. + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/conjure.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/conjure.lua new file mode 100644 index 00000000..788b32e4 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/conjure.lua @@ -0,0 +1,31 @@ +return { + "Olical/conjure", + ft = { "clojure", "fennel", "python", "scheme" }, -- etc + -- [Optional] cmp-conjure for cmp + dependencies = { + { + "PaterJason/cmp-conjure", + config = function() + local cmp = require "cmp" + local config = cmp.get_config() + table.insert(config.sources, { + name = "buffer", + option = { + sources = { + { name = "conjure" }, + }, + }, + }) + cmp.setup(config) + end, + }, + }, + config = function(_, opts) + require("conjure.main").main() + require("conjure.mapping")["on-filetype"]() + end, + init = function() + -- Set configuration options here + vim.g["conjure#debug"] = true + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/copilot.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/copilot.lua new file mode 100644 index 00000000..7215945f --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/copilot.lua @@ -0,0 +1,10 @@ +-- Custom copilot-lua to enable filetypes: markdown +return { + "zbirenbaum/copilot.lua", + opts = function(_, opts) + opts.filetypes = { + yaml = true, + markdown = true, + } + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/flash.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/flash.lua new file mode 100644 index 00000000..1107f878 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/flash.lua @@ -0,0 +1 @@ +return { "folke/flash.nvim", vscode = false } diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/goto-preview.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/goto-preview.lua new file mode 100644 index 00000000..685159b5 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/goto-preview.lua @@ -0,0 +1,5 @@ +-- implementation/definition preview +return { + "rmagatti/goto-preview", + config = function() require("goto-preview").setup {} end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/markdown-preview.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/markdown-preview.lua new file mode 100644 index 00000000..de9b5151 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/markdown-preview.lua @@ -0,0 +1,12 @@ +-- markdown preview +return { + "0x00-ketsu/markdown-preview.nvim", + ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" }, + config = function() + require("markdown-preview").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the setup section below + } + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua new file mode 100644 index 00000000..c290d814 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua @@ -0,0 +1,64 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Mason plugins + +---@type LazySpec +return { + -- use mason-lspconfig to configure LSP installations + { + "williamboman/mason-lspconfig.nvim", + -- mason is unusable on NixOS, disable it. + -- ensure_installed nothing + opts = function(_, opts) + opts.ensure_installed = nil + opts.automatic_installation = false + end, + + -- overrides `require("mason-lspconfig").setup(...)` + -- opts = function(_, opts) + -- -- add more things to the ensure_installed table protecting against community packs modifying it + -- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { + -- "lua_ls", + -- -- add more arguments for adding more language servers + -- }) + -- end, + }, + -- use mason-null-ls to configure Formatters/Linter installation for null-ls sources + { + "jay-babu/mason-null-ls.nvim", + -- mason is unusable on NixOS, disable it. + -- ensure_installed nothing + opts = function(_, opts) + opts.ensure_installed = nil + opts.automatic_installation = false + end, + + -- -- overrides `require("mason-null-ls").setup(...)` + -- opts = function(_, opts) + -- -- add more things to the ensure_installed table protecting against community packs modifying it + -- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { + -- "prettier", + -- "stylua", + -- -- add more arguments for adding more null-ls sources + -- }) + -- end, + }, + { + "jay-babu/mason-nvim-dap.nvim", + -- mason is unusable on NixOS, disable it. + -- ensure_installed nothing + opts = function(_, opts) + opts.ensure_installed = nil + opts.automatic_installation = false + end, + + -- overrides `require("mason-nvim-dap").setup(...)` + -- opts = function(_, opts) + -- -- add more things to the ensure_installed table protecting against community packs modifying it + -- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { + -- "python", + -- -- add more arguments for adding more debuggers + -- }) + -- end, + }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/neo-tree.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 00000000..3359d240 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,13 @@ +-- File explorer(Custom configs) +return { + "nvim-neo-tree/neo-tree.nvim", + opts = { + filesystem = { + filtered_items = { + visible = true, -- visible by default + hide_dotfiles = false, + hide_gitignored = false, + }, + }, + }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/neodev.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/neodev.lua new file mode 100644 index 00000000..654ba51a --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/neodev.lua @@ -0,0 +1,2 @@ +-- full signature help, docs and completion for the nvim lua API. +return { "folke/neodev.nvim", opts = {} } diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/nfnl.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/nfnl.lua new file mode 100644 index 00000000..8cb8f440 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/nfnl.lua @@ -0,0 +1 @@ +return { "Olical/nfnl", ft = "fennel" } diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua new file mode 100644 index 00000000..e1f22323 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua @@ -0,0 +1,59 @@ +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(_, config) + -- config variable is the default configuration table for the setup function call + local null_ls = require "null-ls" + local code_actions = null_ls.builtins.code_actions + local diagnostics = null_ls.builtins.diagnostics + local formatting = null_ls.builtins.formatting + local hover = null_ls.builtins.hover + local completion = null_ls.builtins.completion + + -- 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 + config.sources = { + -- Common Code Actions + code_actions.gitsigns, + -- common refactoring actions based off the Refactoring book by Martin Fowler + code_actions.refactoring, + code_actions.gomodifytags, -- Go - modify struct field tags + code_actions.impl, -- Go - generate interface method stubs + code_actions.shellcheck, + code_actions.proselint, -- English prose linter + code_actions.statix, -- Lints and suggestions for Nix. + + -- Diagnostic + diagnostics.actionlint, -- GitHub Actions workflow syntax checking + diagnostics.buf, -- check text in current buffer + diagnostics.checkmake, -- check Makefiles + diagnostics.deadnix, -- Scan Nix files for dead code. + + -- Formatting + formatting.prettier, -- js/ts/vue/css/html/json/... formatter + diagnostics.hadolint, -- Dockerfile linter + formatting.black, -- Python formatter + formatting.ruff, -- extremely fast Python linter + formatting.goimports, -- Go formatter + formatting.shfmt, -- Shell formatter + formatting.rustfmt, -- Rust formatter + formatting.taplo, -- TOML formatteautoindentr + formatting.terraform_fmt, -- Terraform formatter + formatting.stylua, -- Lua formatter + formatting.alejandra, -- Nix formatter + formatting.sqlfluff.with { -- SQL formatter + extra_args = { "--dialect", "postgres" }, -- change to your dialect + }, + formatting.nginx_beautifier, -- Nginx formatter + formatting.verible_verilog_format, -- Verilog formatter + formatting.emacs_scheme_mode, -- using emacs in batch mode to format scheme files. + formatting.fnlfmt, -- Format Fennel code + } + return config -- return final config table + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/nvim-spectre.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/nvim-spectre.lua new file mode 100644 index 00000000..4f8ac1b7 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/nvim-spectre.lua @@ -0,0 +1,7 @@ +-- The plugin offers the abilibty to search and replace. +return { + "nvim-pack/nvim-spectre", + dependencies = { + { "nvim-lua/plenary.nvim" }, + }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/orgmode.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/orgmode.lua new file mode 100644 index 00000000..dfef0c4b --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/orgmode.lua @@ -0,0 +1,26 @@ +return { + "nvim-orgmode/orgmode", + dependencies = { + { "nvim-treesitter/nvim-treesitter", lazy = true }, + }, + event = "VeryLazy", + config = function() + -- Load treesitter grammar for org + require("orgmode").setup_ts_grammar() + + -- Setup treesitter + require("nvim-treesitter.configs").setup { + highlight = { + enable = true, + additional_vim_regex_highlighting = { "org" }, + }, + ensure_installed = { "org" }, + } + + -- Setup orgmode + require("orgmode").setup { + org_agenda_files = "~/org/**/*", + org_default_notes_file = "~/org/refile.org", + } + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/panifer-rust.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/panifer-rust.lua new file mode 100644 index 00000000..0218508e --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/panifer-rust.lua @@ -0,0 +1,5 @@ +return { + "eraserhd/parinfer-rust", + build = "cargo build --release", + ft = { "scm", "scheme" }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/refactoring.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/refactoring.lua new file mode 100644 index 00000000..aa6704e8 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/refactoring.lua @@ -0,0 +1,8 @@ +-- The plugin offers the alibity to refactor code. +return { + "ThePrimeagen/refactoring.nvim", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-treesitter/nvim-treesitter" }, + }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/sentiment.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/sentiment.lua new file mode 100644 index 00000000..3d8f967d --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/sentiment.lua @@ -0,0 +1,13 @@ +-- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair. +return { + "utilyre/sentiment.nvim", + version = "*", + event = "VeryLazy", -- keep for lazy loading + opts = { + -- config + }, + init = function() + -- `matchparen.vim` needs to be disabled manually in case of lazy loading + vim.g.loaded_matchparen = 1 + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua new file mode 100644 index 00000000..1c53f5f4 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua @@ -0,0 +1,44 @@ +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { "nvim-lua/plenary.nvim" }, + init = function() + -- 1. Disable highlighting for certain filetypes + -- 2. Ignore files larger than a certain filesize + local previewers = require "telescope.previewers" + + local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array + local filesize_threshold = 300 * 1024 -- 300KB + local bad_files = function(filepath) + for _, v in ipairs(_bad) do + if filepath:match(v) then return false end + end + return true + end + + local new_maker = function(filepath, bufnr, opts) + opts = opts or {} + if opts.use_ft_detect == nil then opts.use_ft_detect = true end + + -- 1. Check if the file is in the bad_files array, and if so, don't highlight it + opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath) + + -- 2. Check the file size, and ignore it if it's too big(preview nothing). + filepath = vim.fn.expand(filepath) + vim.loop.fs_stat(filepath, function(_, stat) + if not stat then return end + if stat.size > filesize_threshold then + return + else + previewers.buffer_previewer_maker(filepath, bufnr, opts) + end + end) + end + + require("telescope").setup { + defaults = { + buffer_previewer_maker = new_maker, + }, + } + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/toggleterm.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/toggleterm.lua new file mode 100644 index 00000000..93bfb385 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/toggleterm.lua @@ -0,0 +1,2 @@ +-- disable toggleterm.nvim, zellij's terminal is far better than neovim's one +return { "akinsho/toggleterm.nvim", enabled = false } diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua new file mode 100644 index 00000000..8519384c --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,62 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Treesitter + +---@type LazySpec +return { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.incremental_selection = { + enable = true, + keymaps = { + init_selection = "", -- Ctrl + Space + node_incremental = "", + scope_incremental = "", -- Alt + Space + node_decremental = "", -- Backspace + }, + } + opts.ignore_install = { "gotmpl" } + + -- add more things to the ensure_installed table protecting against community packs modifying it + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { + -- neovim + "vim", + "lua", + -- operation & cloud native + "dockerfile", + "hcl", + "jsonnet", + "regex", + "terraform", + "nix", + "csv", + -- other programming language + "diff", + "gitignore", + "gitcommit", + "latex", + "sql", + -- Lisp like + "fennel", + "clojure", + "commonlisp", + -- customized languages: + "scheme", + }) + + -- add support for scheme + local parser_config = require("nvim-treesitter.parsers").get_parser_configs() + parser_config.scheme = { + install_info = { + url = "https://github.com/6cdh/tree-sitter-scheme", -- local path or git repo + files = { "src/parser.c" }, + -- optional entries: + branch = "main", -- default branch in case of git repo if different from master + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c + }, + } + -- use scheme parser for filetypes: scm + vim.treesitter.language.register("scheme", "scm") + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/treesj.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/treesj.lua new file mode 100644 index 00000000..80290cde --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/treesj.lua @@ -0,0 +1,10 @@ +-- joining blocks of code into oneline, or splitting one line into multiple lines. +return { + "Wansmer/treesj", + keys = { "m", "j", "s" }, + dependencies = { "nvim-treesitter/nvim-treesitter" }, + config = function() + require("treesj").setup { --[[ your config ]] + } + end, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/undo-tree.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/undo-tree.lua new file mode 100644 index 00000000..fc23b1b7 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/undo-tree.lua @@ -0,0 +1,2 @@ +-- Undo tree +return { "debugloop/telescope-undo.nvim" } diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/user.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/user.lua new file mode 100644 index 00000000..121089ef --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/user.lua @@ -0,0 +1,85 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- 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/home/base/tui/editors/neovim/nvim/lua/plugins/yanky.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/yanky.lua new file mode 100644 index 00000000..e52caf0d --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/yanky.lua @@ -0,0 +1,62 @@ +-- clipboard manager +return { + "gbprod/yanky.nvim", + opts = function() + local mapping = require "yanky.telescope.mapping" + local mappings = mapping.get_defaults() + mappings.i[""] = nil + return { + highlight = { timer = 200 }, + picker = { + telescope = { + use_default_mappings = false, + mappings = mappings, + }, + }, + } + end, + keys = { + { + "y", + "(YankyYank)", + mode = { "n", "x" }, + desc = "Yank text", + }, + { + "p", + "(YankyPutAfter)", + mode = { "n", "x" }, + desc = "Put yanked text after cursor", + }, + { + "P", + "(YankyPutBefore)", + mode = { "n", "x" }, + desc = "Put yanked text before cursor", + }, + { + "gp", + "(YankyGPutAfter)", + mode = { "n", "x" }, + desc = "Put yanked text after selection", + }, + { + "gP", + "(YankyGPutBefore)", + mode = { "n", "x" }, + desc = "Put yanked text before selection", + }, + { "[y", "(YankyCycleForward)", desc = "Cycle forward through yank history" }, + { "]y", "(YankyCycleBackward)", desc = "Cycle backward through yank history" }, + { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, + { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, + { "]P", "(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, + { "[P", "(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, + { ">p", "(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" }, + { "(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" }, + { ">P", "(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" }, + { "(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" }, + { "=p", "(YankyPutAfterFilter)", desc = "Put after applying a filter" }, + { "=P", "(YankyPutBeforeFilter)", desc = "Put before applying a filter" }, + }, +} diff --git a/home/base/tui/editors/neovim/nvim/lua/polish.lua b/home/base/tui/editors/neovim/nvim/lua/polish.lua new file mode 100644 index 00000000..14c38cd4 --- /dev/null +++ b/home/base/tui/editors/neovim/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 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/home/base/tui/editors/neovim/nvim/neovim.yml b/home/base/tui/editors/neovim/nvim/neovim.yml new file mode 100644 index 00000000..b9235ab8 --- /dev/null +++ b/home/base/tui/editors/neovim/nvim/neovim.yml @@ -0,0 +1,6 @@ +--- +base: lua51 + +globals: + vim: + any: true diff --git a/home/base/tui/editors/neovim/nvim/selene.toml b/home/base/tui/editors/neovim/nvim/selene.toml new file mode 100644 index 00000000..e7005c33 --- /dev/null +++ b/home/base/tui/editors/neovim/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" From ac844a6a3d8aa685cc89e71d7906c497492e33aa Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 00:32:46 +0800 Subject: [PATCH 2/8] feat(home/base/tui/editors/neovim): astronvim v4 - leader => Leader --- .../neovim/nvim/lua/plugins/astrocore.lua | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua index 3bb22e4b..b3b77311 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua @@ -43,7 +43,7 @@ return { }, g = { -- vim.g. -- configure global vim variables (vim.g) - -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` + -- 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 }, }, @@ -73,7 +73,7 @@ return { -- second key is the lefthand side of the map -- mappings seen under group name "Buffer" - ["bn"] = { "tabnew", desc = "New tab" }, + ["bn"] = { "tabnew", desc = "New tab" }, -- quick save [""] = { ":w!", desc = "Save File" }, -- change description but the same command @@ -82,51 +82,51 @@ return { -- 1. If {cmd} is a List it runs directly (no 'shell') -- 2. If {cmd} is a String it runs in the 'shell' -- search and replace globally - ["ss"] = { 'lua require("spectre").toggle()', desc = "Toggle Spectre" }, - ["sw"] = { + ["ss"] = { 'lua require("spectre").toggle()', desc = "Toggle Spectre" }, + ["sw"] = { 'lua require("spectre").open_visual({select_word=true})', desc = "Search current word", }, - ["sp"] = { + ["sp"] = { 'lua require("spectre").open_file_search({select_word=true})', desc = "Search on current file", }, -- refactoring - ["ri"] = { + ["ri"] = { function() require("refactoring").refactor "Inline Variable" end, desc = "Inverse of extract variable", }, - ["rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" }, - ["rbf"] = { + ["rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" }, + ["rbf"] = { function() require("refactoring").refactor "Extract Block To File" end, desc = "Extract Block To File", }, - ["rr"] = { + ["rr"] = { function() require("telescope").extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply", }, - ["rp"] = { + ["rp"] = { function() require("refactoring").debug.printf { below = false } end, desc = "Insert print statement to mark the calling of a function", }, - ["rv"] = { + ["rv"] = { function() require("refactoring").debug.print_var() end, desc = "Insert print statement to print a variable", }, - ["rc"] = { + ["rc"] = { function() require("refactoring").debug.cleanup {} end, desc = "Cleanup of all generated print statements", }, -- yank_history - ["yh"] = { + ["yh"] = { function() require("telescope").extensions.yank_history.yank_history() end, desc = "Preview Yank History", }, -- undo history - ["uh"] = { "Telescope undo", desc = "Telescope undo" }, + ["uh"] = { "Telescope undo", desc = "Telescope undo" }, -- implementation/definition preview ["gpd"] = { "lua require('goto-preview').goto_preview_definition()", desc = "goto_preview_definition" }, @@ -148,28 +148,28 @@ return { -- Visual mode v = { -- search and replace globally - ["sw"] = { 'lua require("spectre").open_visual()', desc = "Search current word" }, + ["sw"] = { 'lua require("spectre").open_visual()', desc = "Search current word" }, }, -- visual mode(what's the difference between v and x???) x = { -- refactoring - ["ri"] = { + ["ri"] = { function() require("refactoring").refactor "Inline Variable" end, desc = "Inverse of extract variable", }, - ["re"] = { + ["re"] = { function() require("refactoring").refactor "Extract Function" end, desc = "Extracts the selected code to a separate function", }, - ["rf"] = { + ["rf"] = { function() require("refactoring").refactor "Extract Function To File" end, desc = "Extract Function To File", }, - ["rv"] = { + ["rv"] = { function() require("refactoring").refactor "Extract Variable" end, desc = "Extracts occurrences of a selected expression to its own variable", }, - ["rr"] = { + ["rr"] = { function() require("telescope").extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply", }, From 9a45cc64487a2c6ebd7f135161e78baa5235202c Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 00:35:05 +0800 Subject: [PATCH 3/8] feat(home/base/tui/editors/neovim): astronvim v4 - gT => gy --- home/base/tui/editors/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/base/tui/editors/README.md b/home/base/tui/editors/README.md index bb3cf686..bcc309e2 100644 --- a/home/base/tui/editors/README.md +++ b/home/base/tui/editors/README.md @@ -205,7 +205,7 @@ The postfix(flags) in the above commands: | Show all buffers | `:ls` | | show next/previous buffer | `]b`/`[b` or `:bn[ext]` / `bp[rev]` | | New Tab(New Workspace in DoomEmacs) | `:tabnew` | -| Next/Previews Tab | `gt`/`gT` | +| Next/Previews Tab | `gt`/`gy` | ### History From fd62548dc0cd40366b8ca407c8b600db9a4cfdae Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 00:36:57 +0800 Subject: [PATCH 4/8] feat(home/base/tui/editors/neovim): astronvim v4 - comment some demo --- .../tui/editors/neovim/nvim/lua/polish.lua | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/home/base/tui/editors/neovim/nvim/lua/polish.lua b/home/base/tui/editors/neovim/nvim/lua/polish.lua index 14c38cd4..8b32fc1e 100644 --- a/home/base/tui/editors/neovim/nvim/lua/polish.lua +++ b/home/base/tui/editors/neovim/nvim/lua/polish.lua @@ -5,14 +5,14 @@ if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE -- 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", - }, -} +-- vim.filetype.add { +-- extension = { +-- foo = "fooscript", +-- }, +-- filename = { +-- ["Foofile"] = "fooscript", +-- }, +-- pattern = { +-- ["~/%.config/foo/.*"] = "fooscript", +-- }, +-- } From efc524466c477019d67d52f4ef3c763ec261dba0 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 00:38:50 +0800 Subject: [PATCH 5/8] chore: remove astronvim from flake inputs --- flake.lock | 18 ------------------ flake.nix | 5 ----- 2 files changed, 23 deletions(-) diff --git a/flake.lock b/flake.lock index 49c10b45..79dd3221 100644 --- a/flake.lock +++ b/flake.lock @@ -69,23 +69,6 @@ "type": "github" } }, - "astronvim": { - "flake": false, - "locked": { - "lastModified": 1705337239, - "narHash": "sha256-jF+D2CdnSJ5at9HYrDGHKYodVL4VBdqA94OPBu4ESUo=", - "owner": "AstroNvim", - "repo": "AstroNvim", - "rev": "c58489a292fc2ebbc662c54a45213b01f7401f41", - "type": "github" - }, - "original": { - "owner": "AstroNvim", - "ref": "v3.41.2", - "repo": "AstroNvim", - "type": "github" - } - }, "crane": { "inputs": { "nixpkgs": [ @@ -1584,7 +1567,6 @@ "inputs": { "agenix": "agenix", "anyrun": "anyrun", - "astronvim": "astronvim", "daeuniverse": "daeuniverse", "disko": "disko", "doomemacs": "doomemacs", diff --git a/flake.nix b/flake.nix index 7191efc3..b5a0c038 100644 --- a/flake.nix +++ b/flake.nix @@ -123,11 +123,6 @@ ######################## Some non-flake repositories ######################################### - # AstroNvim is an aesthetic and feature-rich neovim config. - astronvim = { - url = "github:AstroNvim/AstroNvim/v3.41.2"; - flake = false; - }; # doom-emacs is a configuration framework for GNU Emacs. doomemacs = { url = "github:doomemacs/doomemacs"; From a1d827a34ed90a2c32521765aed7e10596d17ac4 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 21:51:17 +0800 Subject: [PATCH 6/8] fix: astronvim colorscheme - catppuccin --- home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua | 5 ++++- home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua b/home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua index 7985342b..bdcb5346 100644 --- a/home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua +++ b/home/base/tui/editors/neovim/nvim/lua/lazy_setup.lua @@ -14,7 +14,10 @@ require("lazy").setup({ { import = "plugins" }, } --[[@as LazySpec]], { -- Configure any other `lazy.nvim` configuration options here - install = { colorscheme = { "catppuccin"}, }, + -- https://github.com/folke/lazy.nvim?tab=readme-ov-file#%EF%B8%8F-configuration + + -- try to load one of these colorschemes when starting an installation during startup + install = { colorscheme = { "catppuccin" }, }, ui = { backdrop = 100 }, performance = { rtp = { diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua index 2080aa98..b4129369 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua @@ -11,7 +11,8 @@ return { ---@type AstroUIOpts opts = { -- change colorscheme - colorscheme = "astrodark", + -- colorscheme = "astrodark", + 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 From fb6ca6b12d7cb87b7a7fc2b0f1a7be8d6801dac3 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 21:59:57 +0800 Subject: [PATCH 7/8] fix: telescope extensions, astrocore & astrolsp --- Justfile | 8 +- .../tui/editors/neovim/nvim/lua/community.lua | 2 - .../neovim/nvim/lua/plugins/astrocore.lua | 78 +------------------ .../neovim/nvim/lua/plugins/astrolsp.lua | 55 ++++++++++++- .../neovim/nvim/lua/plugins/astroui.lua | 2 - .../editors/neovim/nvim/lua/plugins/mason.lua | 2 - .../neovim/nvim/lua/plugins/none-ls.lua | 2 - .../neovim/nvim/lua/plugins/telescope.lua | 5 ++ .../neovim/nvim/lua/plugins/treesitter.lua | 2 - .../editors/neovim/nvim/lua/plugins/user.lua | 2 - .../tui/editors/neovim/nvim/lua/polish.lua | 2 - 11 files changed, 65 insertions(+), 95 deletions(-) diff --git a/Justfile b/Justfile index ce99adfe..cdcae182 100644 --- a/Justfile +++ b/Justfile @@ -263,11 +263,11 @@ path: $env.PATH | split row ":" nvim-test: - rm -rf $"($env.HOME)/.config/astronvim/lua/user" - rsync -avz --copy-links --chmod=D2755,F744 home/base/desktop/editors/neovim/astronvim_user/ $"($env.HOME)/.config/astronvim/lua/user" + rm -rf $"($env.HOME)/.config/nvim" + rsync -avz --copy-links --chmod=D2755,F744 home/base/tui/editors/neovim/nvim/ $"($env.HOME)/.config/nvim/" nvim-clean: - rm -rf $"($env.HOME)/.config/astronvim/lua/user" + rm -rf $"($env.HOME)/.config/nvim" # ================================================= # Emacs related commands @@ -289,7 +289,7 @@ reload-emacs-cmd := if os() == "macos" { emacs-test: rm -rf $"($env.HOME)/.config/doom" - rsync -avz --copy-links --chmod=D2755,F744 home/base/desktop/editors/emacs/doom/ $"($env.HOME)/.config/doom" + rsync -avz --copy-links --chmod=D2755,F744 home/base/tui/editors/emacs/doom/ $"($env.HOME)/.config/doom/" doom clean doom sync diff --git a/home/base/tui/editors/neovim/nvim/lua/community.lua b/home/base/tui/editors/neovim/nvim/lua/community.lua index a80d0491..29cd0aa2 100644 --- a/home/base/tui/editors/neovim/nvim/lua/community.lua +++ b/home/base/tui/editors/neovim/nvim/lua/community.lua @@ -1,5 +1,3 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- 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. diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua index b3b77311..6ed124ca 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astrocore.lua @@ -1,14 +1,8 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- 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 -require("telescope").load_extension "refactoring" -require("telescope").load_extension "yank_history" -require("telescope").load_extension "undo" - ---@type LazySpec return { "AstroNvim/astrocore", @@ -48,34 +42,18 @@ return { }, }, -- Mappings can be configured through AstroCore as well. + -- https://docs.astronvim.com/recipes/mappings/ -- 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.count1) end, desc = "Next buffer" }, - H = { function() require("astrocore.buffer").nav(-vim.v.count1) 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" }, - -- second key is the lefthand side of the map -- mappings seen under group name "Buffer" ["bn"] = { "tabnew", desc = "New tab" }, -- quick save - [""] = { ":w!", desc = "Save File" }, -- change description but the same command + -- [""] = { ":w!", desc = "Save File" }, -- Terminal -- NOTE: https://neovim.io/doc/user/builtin.html#jobstart() @@ -92,33 +70,6 @@ return { desc = "Search on current file", }, - -- refactoring - ["ri"] = { - function() require("refactoring").refactor "Inline Variable" end, - desc = "Inverse of extract variable", - }, - ["rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" }, - ["rbf"] = { - function() require("refactoring").refactor "Extract Block To File" end, - desc = "Extract Block To File", - }, - ["rr"] = { - function() require("telescope").extensions.refactoring.refactors() end, - desc = "Prompt for a refactor to apply", - }, - ["rp"] = { - function() require("refactoring").debug.printf { below = false } end, - desc = "Insert print statement to mark the calling of a function", - }, - ["rv"] = { - function() require("refactoring").debug.print_var() end, - desc = "Insert print statement to print a variable", - }, - ["rc"] = { - function() require("refactoring").debug.cleanup {} end, - desc = "Cleanup of all generated print statements", - }, - -- yank_history ["yh"] = { function() require("telescope").extensions.yank_history.yank_history() end, @@ -150,30 +101,7 @@ return { -- search and replace globally ["sw"] = { 'lua require("spectre").open_visual()', desc = "Search current word" }, }, - -- visual mode(what's the difference between v and x???) - x = { - -- refactoring - ["ri"] = { - function() require("refactoring").refactor "Inline Variable" end, - desc = "Inverse of extract variable", - }, - ["re"] = { - function() require("refactoring").refactor "Extract Function" end, - desc = "Extracts the selected code to a separate function", - }, - ["rf"] = { - function() require("refactoring").refactor "Extract Function To File" end, - desc = "Extract Function To File", - }, - ["rv"] = { - function() require("refactoring").refactor "Extract Variable" end, - desc = "Extracts occurrences of a selected expression to its own variable", - }, - ["rr"] = { - function() require("telescope").extensions.refactoring.refactors() end, - desc = "Prompt for a refactor to apply", - }, - }, + }, }, } diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua index ad5efa6d..ad0fa1d8 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astrolsp.lua @@ -1,10 +1,9 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- 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", @@ -131,6 +130,7 @@ return { 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, @@ -142,6 +142,57 @@ return { -- desc = "Toggle LSP semantic highlight (buffer)", -- cond = function(client) return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end, -- }, + + -- refactoring + ["ri"] = { + function() require("refactoring").refactor "Inline Variable" end, + desc = "Inverse of extract variable", + }, + ["rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" }, + ["rbf"] = { + function() require("refactoring").refactor "Extract Block To File" end, + desc = "Extract Block To File", + }, + ["rr"] = { + function() require("telescope").extensions.refactoring.refactors() end, + desc = "Prompt for a refactor to apply", + }, + ["rp"] = { + function() require("refactoring").debug.printf { below = false } end, + desc = "Insert print statement to mark the calling of a function", + }, + ["rv"] = { + function() require("refactoring").debug.print_var() end, + desc = "Insert print statement to print a variable", + }, + ["rc"] = { + function() require("refactoring").debug.cleanup {} end, + desc = "Cleanup of all generated print statements", + }, + }, + -- visual mode(what's the difference between v and x???) + x = { + -- refactoring + ["ri"] = { + function() require("refactoring").refactor "Inline Variable" end, + desc = "Inverse of extract variable", + }, + ["re"] = { + function() require("refactoring").refactor "Extract Function" end, + desc = "Extracts the selected code to a separate function", + }, + ["rf"] = { + function() require("refactoring").refactor "Extract Function To File" end, + desc = "Extract Function To File", + }, + ["rv"] = { + function() require("refactoring").refactor "Extract Variable" end, + desc = "Extracts occurrences of a selected expression to its own variable", + }, + ["rr"] = { + function() require("telescope").extensions.refactoring.refactors() end, + desc = "Prompt for a refactor to apply", + }, }, }, -- A custom `on_attach` function to be run after the default `on_attach` function diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua index b4129369..d1135454 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/astroui.lua @@ -1,5 +1,3 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- 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`) diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua index c290d814..12bdb9c5 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/mason.lua @@ -1,5 +1,3 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- Customize Mason plugins ---@type LazySpec diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua index e1f22323..f30a3f2a 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua @@ -1,5 +1,3 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- Customize None-ls sources ---@type LazySpec diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua index 1c53f5f4..f8d00c8e 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/telescope.lua @@ -33,6 +33,11 @@ return { previewers.buffer_previewer_maker(filepath, bufnr, opts) end end) + + -- Load Extensions + require("telescope").load_extension "refactoring" + require("telescope").load_extension "yank_history" + require("telescope").load_extension "undo" end require("telescope").setup { diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua index 8519384c..3d597783 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua @@ -1,5 +1,3 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- Customize Treesitter ---@type LazySpec diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/user.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/user.lua index 121089ef..76fd493a 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/user.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/user.lua @@ -1,5 +1,3 @@ -if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE - -- You can also add or configure plugins by creating files in this `plugins/` folder -- Here are some examples: diff --git a/home/base/tui/editors/neovim/nvim/lua/polish.lua b/home/base/tui/editors/neovim/nvim/lua/polish.lua index 8b32fc1e..1acdac90 100644 --- a/home/base/tui/editors/neovim/nvim/lua/polish.lua +++ b/home/base/tui/editors/neovim/nvim/lua/polish.lua @@ -1,5 +1,3 @@ -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 just pure lua so anything that doesn't -- fit in the normal config locations above can go here From 0e31ec94ce9eba2df94cd3901ed90756f981578e Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 13 Apr 2024 23:03:20 +0800 Subject: [PATCH 8/8] fix: astronvim v4 - none-ls formatting - https://github.com/nvimtools/none-ls.nvim/issues/58 --- home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua index f30a3f2a..e3cd1941 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/none-ls.lua @@ -22,7 +22,6 @@ return { code_actions.refactoring, code_actions.gomodifytags, -- Go - modify struct field tags code_actions.impl, -- Go - generate interface method stubs - code_actions.shellcheck, code_actions.proselint, -- English prose linter code_actions.statix, -- Lints and suggestions for Nix. @@ -36,11 +35,8 @@ return { formatting.prettier, -- js/ts/vue/css/html/json/... formatter diagnostics.hadolint, -- Dockerfile linter formatting.black, -- Python formatter - formatting.ruff, -- extremely fast Python linter formatting.goimports, -- Go formatter formatting.shfmt, -- Shell formatter - formatting.rustfmt, -- Rust formatter - formatting.taplo, -- TOML formatteautoindentr formatting.terraform_fmt, -- Terraform formatter formatting.stylua, -- Lua formatter formatting.alejandra, -- Nix formatter