From 200f428b3c17ba62ff54b06426fd08fbedbf7ff8 Mon Sep 17 00:00:00 2001 From: Segcolt Date: Tue, 5 May 2026 21:55:42 -0300 Subject: [PATCH] Update config to astronvim V6 --- .gitignore | 2 +- init.lua | 10 +++- lua/community.lua | 35 ++++++----- lua/init.lua | 94 ------------------------------ lua/lazy_setup.lua | 4 +- lua/plugins/astrocore.lua | 82 +++++++++++++------------- lua/plugins/astrolsp.lua | 79 +++++++++++-------------- lua/plugins/astroui.lua | 1 - lua/plugins/autopairs.lua | 3 + lua/plugins/codesnap.lua | 3 +- lua/plugins/competitest.lua | 4 +- lua/plugins/core.lua | 77 ------------------------- lua/plugins/editor.lua | 20 +++++-- lua/plugins/kitty.lua | 4 ++ lua/plugins/mason.lua | 15 +---- lua/plugins/neo-tree.lua | 5 -- lua/plugins/noice.lua | 9 +-- lua/plugins/none-ls.lua | 12 ++-- lua/plugins/nvim-cmp.lua | 15 ----- lua/plugins/roslyn.lua | 9 --- lua/plugins/telescope.lua | 107 ---------------------------------- lua/plugins/treesitter.lua | 112 ++++++------------------------------ lua/plugins/user.lua | 99 +++++++++++++++++++++++++++---- lua/polish.lua | 17 +----- 24 files changed, 252 insertions(+), 566 deletions(-) delete mode 100644 lua/init.lua create mode 100644 lua/plugins/autopairs.lua delete mode 100644 lua/plugins/core.lua create mode 100644 lua/plugins/kitty.lua delete mode 100644 lua/plugins/neo-tree.lua delete mode 100644 lua/plugins/nvim-cmp.lua delete mode 100644 lua/plugins/roslyn.lua delete mode 100644 lua/plugins/telescope.lua diff --git a/.gitignore b/.gitignore index e033bc6..a6c57f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -lazy-lock.json +*.json diff --git a/init.lua b/init.lua index 2ce1cdd..424e48d 100644 --- a/init.lua +++ b/init.lua @@ -1,10 +1,18 @@ -- 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 }) + local result = vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) + if vim.v.shell_error ~= 0 then + -- stylua: ignore + vim.api.nvim_echo({ { ("Error cloning lazy.nvim:\n%s\n"):format(result), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() + end end + vim.opt.rtp:prepend(lazypath) -- validate that lazy is available diff --git a/lua/community.lua b/lua/community.lua index e5585ab..9a61563 100644 --- a/lua/community.lua +++ b/lua/community.lua @@ -1,19 +1,26 @@ +-- AstroCommunity: import any community modules here +-- We import this file in `lazy_setup.lua` before the `plugins/` folder. +-- This guarantees that the specs are processed before any user plugins. + +---@type LazySpec return { "AstroNvim/astrocommunity", - - -- { import = "astrocommunity.colorscheme.catppuccin" }, - -- { - -- "catppuccin", - -- opts = { - -- integrations = { - -- ts_rainbow2 = true, - -- treesitter = true, - -- } - -- }, - -- config = function() - -- vim.api.nvim_set_hl(0, "LspInlayHint", { bg = "#1e1e2f" }) - -- end - -- }, + { import = "astrocommunity.pack.lua" }, + -- import/override with your plugins folder + { import = "astrocommunity.colorscheme.catppuccin" }, + { + "catppuccin", + opts = { + integrations = { + ts_rainbow2 = true, + treesitter = true, + }, + transparent_background = true + }, + -- config = function() + -- vim.api.nvim_set_hl(0, "LspInlayHint", { bg = "#1e1e2f" }) + -- end + }, -- { import = "astrocommunity.pack.cpp" }, diff --git a/lua/init.lua b/lua/init.lua deleted file mode 100644 index 25824d6..0000000 --- a/lua/init.lua +++ /dev/null @@ -1,94 +0,0 @@ -return { - -- Configure AstroNvim updates - updater = { - remote = "origin", -- remote to use - channel = "stable", -- "stable" or "nightly" - version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) - branch = "nightly", -- branch name (NIGHTLY ONLY) - commit = nil, -- commit hash (NIGHTLY ONLY) - pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only) - skip_prompts = false, -- skip prompts about breaking changes - show_changelog = true, -- show the changelog after performing an update - auto_quit = false, -- automatically quit the current session after a successful update - remotes = { -- easily add new remotes to track - -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url - -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, - -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork - }, - }, - - -- Configure require("lazy").setup() options - lazy = { - defaults = { lazy = true }, - performance = { - rtp = { - -- customize default disabled vim plugins - disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" }, - }, - }, - }, - - -- This function is run last and is a good place to configuring - -- augroups/autocommands and custom filetypes also this just pure lua so - -- anything that doesn't fit in the normal config locations above can go here - polish = function() - -- Set up custom filetypes - -- vim.filetype.add { - -- extension = { - -- foo = "fooscript", - -- }, - -- filename = { - -- ["Foofile"] = "fooscript", - -- }, - -- pattern = { - -- ["~/%.config/foo/.*"] = "fooscript", - -- }, - -- } - - vim.filetype.add { - extension = { - asm = "nasm", - }, - } - - require("catppuccin").compile() - - vim.api.nvim_create_autocmd({ "VimEnter" }, { - command = [[ let $SHELL="/bin/fish" ]] - }) - - vim.api.nvim_create_autocmd({ "FileType", "BufRead", "BufNewFile" }, { - pattern = "*.s", - callback = function() - local indentation = 8 - vim.opt_local.expandtab = true - vim.opt_local.tabstop = indentation - vim.opt_local.shiftwidth = indentation - vim.opt_local.filetype = "s-asm" - vim.opt_local.syntax = "s-asm" - vim.opt_local.formatoptions = vim.opt_local.formatoptions + "r" - end, - }) - - vim.api.nvim_create_autocmd({ "FileType", "BufRead", "BufNewFile" }, { - pattern = "*.hdl", - callback = function() - local indentation = 4 - vim.opt_local.expandtab = true - vim.opt_local.tabstop = indentation - vim.opt_local.shiftwidth = indentation - vim.opt_local.formatoptions = vim.opt_local.formatoptions + "r" - end, - }) - - vim.api.nvim_create_autocmd({ "FileType", "BufRead", "BufNewFile" }, { - pattern = "*.lua", - callback = function() - local indentation = 4 - vim.opt_local.expandtab = true - vim.opt_local.tabstop = indentation - vim.opt_local.shiftwidth = indentation - end, - }) - end, -} diff --git a/lua/lazy_setup.lua b/lua/lazy_setup.lua index 621de3b..8e1abfb 100644 --- a/lua/lazy_setup.lua +++ b/lua/lazy_setup.lua @@ -1,7 +1,7 @@ require("lazy").setup({ { "AstroNvim/AstroNvim", - version = "^4", -- Remove version tracking to elect for nighly AstroNvim + version = "^6", -- Remove version tracking to elect for nightly AstroNvim import = "astronvim.plugins", opts = { -- AstroNvim options must be set here with the `import` key mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up @@ -15,7 +15,7 @@ require("lazy").setup({ { import = "plugins" }, } --[[@as LazySpec]], { -- Configure any other `lazy.nvim` configuration options here - install = { colorscheme = { "astrodark", "habamax" } }, + install = { colorscheme = { "astrotheme", "habamax" } }, ui = { backdrop = 100 }, performance = { rtp = { diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index 2d0b83b..5856011 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -10,21 +10,12 @@ return { "AstroNvim/astrocore", ---@type AstroCoreOpts opts = { - sessions = { - autosave = { - last = true, - cwd = true, - }, - ignore = { - dirs = { "wiki" }, - }, - }, -- Configure core features of AstroNvim features = { - large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter autopairs = false, -- 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) + diagnostics = { virtual_text = true, virtual_lines = false }, -- diagnostic settings on startup highlighturl = true, -- highlight URLs at start notifications = true, -- enable notifications at start }, @@ -33,13 +24,26 @@ return { virtual_text = true, underline = true, }, + -- passed to `vim.filetype.add` + filetypes = { + -- see `:h vim.filetype.add` for usage + extension = { + foo = "fooscript", + }, + filename = { + [".foorc"] = "fooscript", + }, + pattern = { + [".*/etc/foo/.*"] = "fooscript", + }, + }, -- vim options can be configured here options = { opt = { -- vim.opt. relativenumber = true, -- sets vim.opt.relativenumber number = true, -- sets vim.opt.number spell = false, -- sets vim.opt.spell - signcolumn = "auto", -- sets vim.opt.signcolumn to auto + signcolumn = "yes", -- sets vim.opt.signcolumn to yes wrap = false, -- sets vim.opt.wrap expandtab = false, cursorline = false, @@ -54,20 +58,20 @@ return { -- 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 mapleader = " ", -- sets vim.g.mapleader - autoformat_enabled = false, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled) cmp_enabled = true, -- enable completion at start - autopairs_enabled = false, -- enable autopairs at start diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on) icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing) + autoformat_enabled = false, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled) + autopairs_enabled = false, -- enable autopairs at start ui_notifications_enabled = true, -- disable notifications when toggling UI elements c_syntax_for_h = 1, - wiki_root = '~/Documentos/Wiki', - -- vimtex + -- Vimtex vimtex_view_method = "zathura", vimtex_compiler_latexmk = { - aux_dir = "/run/user/1000/vimtex" + aux_dir = "/run/user/1000/vimtex-aux" }, - -- wiki + -- Wiki + wiki_root = '~/Documentos/Wiki', wiki_journal = { name = "journal", frequency = "daily", @@ -90,6 +94,26 @@ return { n = { -- second key is the lefthand side of the map + -- navigate buffer tabs + ["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, + ["[b"] = { 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 = "Close buffer from tabline", + }, + + -- tables with just a `desc` key will be registered with which-key if it's installed + -- this is useful for naming menus + -- ["b"] = { desc = "Buffers" }, + + -- setting a mapping to false will disable it + -- [""] = false, -- 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" }, @@ -154,8 +178,6 @@ return { ["b"] = { desc = "Buffers" }, -- quick save -- [""] = { ":w!", desc = "Save File" }, -- change description but the same command - n = { utils.better_search "n", desc = "Next search" }, - N = { utils.better_search "N", desc = "Previous search" }, [""] = { function() require("smart-splits").resize_up(2) end, desc = "Resize split up" }, [""] = { function() require("smart-splits").resize_down(2) end, desc = "Resize split down" }, [""] = { function() require("smart-splits").resize_left(2) end, desc = "Resize split left" }, @@ -290,26 +312,6 @@ return { [""] = { ":w!", desc = "Save File" }, -- change description but the same command [""] = { function() require("luasnip").jump(1) end, desc = "Jump to next snippet" }, }, - v = { - ["s"] = { function() require("spectre").open_visual() end, desc = "Spectre" }, - }, - t = { - -- setting a mapping to false will disable it - -- [""] = false, - }, - x = { - -- better increment/decrement - ["+"] = { "g", desc = "Increment number" }, - ["-"] = { "g", desc = "Descrement number" }, - -- Easy-Align - ga = { "(EasyAlign)", desc = "Easy Align" }, - }, - o = { - -- line text-objects - ["il"] = { ":normal vil", desc = "Inside line text object" }, - ["al"] = { ":normal val", desc = "Around line text object" }, - }, - }, }, } diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index e502ae0..8485d47 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -10,9 +10,8 @@ return { 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 = true, -- enable/disable inlay hints on start + inlay_hints = false, -- enable/disable inlay hints on start semantic_tokens = true, -- enable/disable semantic token highlighting }, -- customize lsp formatting options @@ -29,7 +28,7 @@ return { }, 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", + -- "lua_ls", }, timeout_ms = 1000, -- default format timeout -- filter = function(client) -- fully override the default formatting function @@ -39,12 +38,13 @@ return { -- enable servers that you already have installed without mason servers = { -- "pyright" - "clangd", + "clangd" }, - -- customize language server configuration options passed to `lspconfig` + -- customize language server configuration passed to `vim.lsp.config` + -- client specific configuration can also go in `lsp/` in your configuration root (see `:h lsp-config`) ---@diagnostic disable: missing-fields config = { - -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + -- ["*"] = { capabilities = {} }, -- modify default LSP client settings such as capabilities clangd = { cmd = { "clangd", @@ -63,76 +63,65 @@ return { dataSourceName = "host=127.0.0.1 port=5432 user=postgres password=postgres dbname=trabalho sslmode=disable" } }, - root_dir = function(path) - -- local normal = require("lspconfig.util").root_pattern(".git")(vim.fn.getcwd()) - -- local normal = require("lspconfig.util").root_pattern(".git")(vim.fn.getcwd()) - local normal = vim.fs.root(vim.fn.getcwd(), { '.git' }) - if normal then - return normal - else - return vim.fn.getcwd() - end - end, + root_markers = {".git"}, + single_file_support = true, filetypes = { "cpp", "c" }, capabilities = { offsetEncoding = "utf-8", - } - } + }, + }, }, -- customize how language servers are attached handlers = { - -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server - -- function(server, opts) require("lspconfig")[server].setup(opts) end + -- a function with the key `*` modifies the default handler, functions takes the server name as the parameter + -- ["*"] = function(server) vim.lsp.enable(server) end - -- the key is the server that is being setup with `lspconfig` + -- the key is the server that is being setup with `vim.lsp.config` -- 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 - -- clangd = function(_, opts) require("clangd_extensions").setup { server = opts } end, }, -- 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 = { + lsp_codelens_refresh = { -- Optional condition to create/delete auto command group -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` -- condition will be resolved for each client on each execution and if it ever fails for all clients, -- the auto commands will be deleted for that buffer - cond = "textDocument/documentHighlight", + cond = "textDocument/codeLens", -- cond = function(client, bufnr) return client.name == "lua_ls" end, -- list of auto commands to set { -- events to trigger - event = { "CursorHold", "CursorHoldI" }, + event = { "InsertLeave", "BufEnter" }, -- 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, + desc = "Refresh codelens (buffer)", + callback = function(args) + if require("astrolsp").config.features.codelens then vim.lsp.codelens.enable(true, { bufnr = args.buf }) end + 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, - -- }, + gD = { + function() vim.lsp.buf.declaration() end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + gl = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, + ["uY"] = { + function() require("astrolsp.toggles").buffer_semantic_tokens() end, + desc = "Toggle LSP semantic highlight (buffer)", + cond = function(client) + return client:supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil + end, + }, }, }, -- A custom `on_attach` function to be run after the default `on_attach` function - -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + -- takes two parameters `client` and `bufnr` (`:h lsp-attach`) on_attach = function(client, bufnr) -- this would disable semanticTokensProvider for all clients -- client.server_capabilities.semanticTokensProvider = nil diff --git a/lua/plugins/astroui.lua b/lua/plugins/astroui.lua index 3262cb4..fc46816 100644 --- a/lua/plugins/astroui.lua +++ b/lua/plugins/astroui.lua @@ -8,7 +8,6 @@ return { "AstroNvim/astroui", ---@type AstroUIOpts opts = { - -- change colorscheme colorscheme = "catppuccin", -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes highlights = { diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua new file mode 100644 index 0000000..e20066c --- /dev/null +++ b/lua/plugins/autopairs.lua @@ -0,0 +1,3 @@ +return { + "windwp/nvim-autopairs", enabled = false +} diff --git a/lua/plugins/codesnap.lua b/lua/plugins/codesnap.lua index 87ede0c..fc25944 100644 --- a/lua/plugins/codesnap.lua +++ b/lua/plugins/codesnap.lua @@ -6,5 +6,6 @@ return { -- bg_theme = "grape", bg_padding = 0, has_line_number = true, - } end + } end, + enabled = false } diff --git a/lua/plugins/competitest.lua b/lua/plugins/competitest.lua index 7549131..18a7894 100644 --- a/lua/plugins/competitest.lua +++ b/lua/plugins/competitest.lua @@ -21,8 +21,8 @@ return { evaluate_template_modifiers = true, received_problems_prompt_path = false, compile_command = { - c = { exec = "gcc", args = { "-O0", "-Wall", "-ggdb3", "-DDEBUG", "-fsanitize=address,undefined", "$(FNAME)", "-o", "$(FNOEXT).out", "-lm" } }, - cpp = { exec = "g++", args = { "-O0", "-Wall", "-ggdb3", "-DDEBUG", "-fsanitize=address,undefined", "-D__OPTIMIZE__", "$(FNAME)", "-o", "$(FNOEXT).out" } }, + c = { exec = "gcc", args = { "-O0", "-Wall", "-ggdb3", "-DDEBUG", "-fsanitize=address,undefined", "-std=c23", "$(FNAME)", "-o", "$(FNOEXT).out", "-lm" } }, + cpp = { exec = "g++", args = { "-O0", "-Wall", "-ggdb3", "-DDEBUG", "-fsanitize=address,undefined", "-D__OPTIMIZE__", "-std=c++20", "$(FNAME)", "-o", "$(FNOEXT).out" } }, }, run_command = { c = { exec = "./$(FNOEXT).out" }, diff --git a/lua/plugins/core.lua b/lua/plugins/core.lua deleted file mode 100644 index be1fc3e..0000000 --- a/lua/plugins/core.lua +++ /dev/null @@ -1,77 +0,0 @@ -return { - -- 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 "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- add more custom luasnip configuration such as filetype extend or custom snippets - -- local luasnip = require "luasnip" - -- luasnip.filetype_extend("javascript", { "javascriptreact" }) - -- end, - -- }, - -- { - -- "windwp/nvim-autopairs", - -- config = function(plugin, opts) - -- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- add more custom autopairs configuration such as custom rules - -- local npairs = require "nvim-autopairs" - -- local Rule = require "nvim-autopairs.rule" - -- local cond = require "nvim-autopairs.conds" - -- npairs.add_rules( - -- { - -- Rule("$", "$", { "tex", "latex" }) - -- -- don't add a pair if the next character is % - -- :with_pair(cond.not_after_regex "%%") - -- -- don't add a pair if the previous character is xxx - -- :with_pair( - -- cond.not_before_regex("xxx", 3) - -- ) - -- -- don't move right when repeat character - -- :with_move(cond.none()) - -- -- don't delete if the next character is xx - -- :with_del(cond.not_after_regex "xx") - -- -- disable adding a newline when you press - -- :with_cr(cond.none()), - -- }, - -- -- disable for .vim files, but it work for another filetypes - -- Rule("a", "a", "-vim") - -- ) - -- end, - -- }, - -- By adding to the which-key config and using our helper function you can add more which-key registered bindings - -- { - -- "folke/which-key.nvim", - -- config = function(plugin, opts) - -- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call - -- -- Add bindings which show up as group name - -- local wk = require "which-key" - -- wk.register({ - -- b = { name = "Buffer" }, - -- }, { mode = "n", prefix = "" }) - -- end, - -- }, -} diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 4b00746..506fbbc 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -61,12 +61,12 @@ return { } }, }, - { - "arsham/indent-tools.nvim", - dependencies = { "arsham/arshlib.nvim" }, - event = "User AstroFile", - config = function() require("indent-tools").config {} end, - }, + -- { + -- "arsham/indent-tools.nvim", + -- dependencies = { "arsham/arshlib.nvim" }, + -- event = "User AstroFile", + -- config = function() require("indent-tools").config {} end, + -- }, { "danymat/neogen", cmd = "Neogen", @@ -135,4 +135,12 @@ return { }, opts = { n_lines = 200 }, }, + { "karb94/neoscroll.nvim", + lazy = false, + opts = { + hide_cursor = true, + stop_eof = true, + mappings = {'', '', '', ''} + } + } } diff --git a/lua/plugins/kitty.lua b/lua/plugins/kitty.lua new file mode 100644 index 0000000..b8da128 --- /dev/null +++ b/lua/plugins/kitty.lua @@ -0,0 +1,4 @@ +return { + "knubie/vim-kitty-navigator", + lazy = false +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index d6609e0..c481c1b 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -11,7 +11,7 @@ return { "bashls", -- "pylsp"=, "pyright", - -- "cmake", + "cmake", "mesonlsp", "vimls", "cssls", @@ -19,19 +19,6 @@ return { }) end, }, - { - "williamboman/mason.nvim", - opts = { - registries = { - -- default Mason registry has highest priority - "github:mason-org/mason-registry", - -- Add the AstroNvim mason registry - "github:AstroNvim/mason-registry", - -- C# lsp - "github:Crashdummyy/mason-registry", - }, - }, - }, -- use mason-null-ls to configure Formatters/Linter installation for null-ls sources { "jay-babu/mason-null-ls.nvim", diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua deleted file mode 100644 index be22508..0000000 --- a/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - dependencies = "nvim-lua/plenary.nvim", - lazy = false, -} diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 04edd41..95f618c 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -1,12 +1,5 @@ return { - { - "rcarriga/nvim-notify", - init = false, - config = true, - opts = { - background_colour = "#000000" - } - }, + { "rcarriga/nvim-notify", init = false, config = true }, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua index 382368d..2b0ed18 100644 --- a/lua/plugins/none-ls.lua +++ b/lua/plugins/none-ls.lua @@ -5,18 +5,20 @@ if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE ---@type LazySpec return { "nvimtools/none-ls.nvim", - opts = function(_, config) - -- config variable is the default configuration table for the setup function call + opts = function(_, opts) + -- opts variable is the default configuration table for the setup function call -- local null_ls = require "null-ls" -- Check supported formatters and linters -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics - config.sources = { + + -- Only insert new sources, do not replace the existing ones + -- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function) + opts.sources = require("astrocore").list_insert_unique(opts.sources, { -- Set a formatter -- null_ls.builtins.formatting.stylua, -- null_ls.builtins.formatting.prettier, - } - return config -- return final config table + }) end, } diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua deleted file mode 100644 index 7405db1..0000000 --- a/lua/plugins/nvim-cmp.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - - config = function(plugin, opts) - local cmp = require "cmp" - - cmp.setup(opts) - - cmp.setup { - experimental = { - ghost_text = true - } - } - end -} diff --git a/lua/plugins/roslyn.lua b/lua/plugins/roslyn.lua deleted file mode 100644 index e33ea2e..0000000 --- a/lua/plugins/roslyn.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "seblyng/roslyn.nvim", - ---@module 'roslyn.config' - ---@type RoslynNvimConfig - opts = { - -- your configuration comes here; leave empty for default settings - }, - ft = "cs" -} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua deleted file mode 100644 index b7b80f3..0000000 --- a/lua/plugins/telescope.lua +++ /dev/null @@ -1,107 +0,0 @@ -return { - "nvim-telescope/telescope.nvim", - dependencies = { - { "nvim-telescope/telescope-fzf-native.nvim", enabled = false }, - "nvim-telescope/telescope-fzy-native.nvim", - "nvim-telescope/telescope-live-grep-args.nvim", - "nvim-telescope/telescope-hop.nvim", - "nvim-telescope/telescope-bibtex.nvim", - "nvim-telescope/telescope-file-browser.nvim", - { - "jay-babu/project.nvim", - name = "project_nvim", - event = "VeryLazy", - opts = { ignore_lsp = { "lua_ls", "julials" } }, - }, - }, - opts = function(_, opts) - local telescope = require "telescope" - local actions = require "telescope.actions" - local fb_actions = require("telescope").extensions.file_browser.actions - local lga_actions = require "telescope-live-grep-args.actions" - local hop = telescope.extensions.hop - return require("astrocore").extend_tbl(opts, { - defaults = { - results_title = "", - selection_caret = " ", - layout_config = { - width = 0.90, - height = 0.85, - preview_cutoff = 120, - horizontal = { - preview_width = 0.6, - }, - vertical = { - width = 0.9, - height = 0.95, - preview_height = 0.5, - }, - flex = { - horizontal = { - preview_width = 0.9, - }, - }, - }, - mappings = { - i = { - [""] = hop.hop, - [""] = function(prompt_bufnr) - hop._hop_loop( - prompt_bufnr, - { callback = actions.toggle_selection, loop_callback = actions.send_selected_to_qflist } - ) - end, - }, - }, - }, - extensions = { - bibtex = { context = true, context_fallback = false }, - file_browser = { - mappings = { - i = { - [""] = fb_actions.toggle_hidden, - }, - n = { - z = fb_actions.toggle_hidden, - }, - }, - }, - live_grep_args = { - auto_quoting = true, -- enable/disable auto-quoting - mappings = { -- extend mappings - i = { - [""] = lga_actions.quote_prompt(), - [""] = lga_actions.quote_prompt { postfix = " --iglob " }, - }, - }, - }, - }, - pickers = { - find_files = { - hidden = true, - find_command = function(cfg) - local find_command = { "rg", "--files", "--color", "never" } - if not cfg.no_ignore then vim.list_extend(find_command, { "--glob", "!**/.git/**" }) end - return find_command - end, - }, - buffers = { - path_display = { "smart" }, - mappings = { - i = { [""] = actions.delete_buffer }, - n = { ["d"] = actions.delete_buffer }, - }, - }, - }, - }) - end, - config = function(...) - -- require "plugins.configs.telescope"(...) - local telescope = require "telescope" - telescope.load_extension "fzy_native" - telescope.load_extension "live_grep_args" - telescope.load_extension "bibtex" - telescope.load_extension "file_browser" - telescope.load_extension "projects" - end, -} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index a59a4c2..9ef1edd 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,14 +1,20 @@ +-- Customize Treesitter +-- -------------------- +-- Treesitter customizations are handled with AstroCore +-- as nvim-treesitter simply provides a download utility for parsers + +---@type LazySpec return { - { - "neovim-treesitter/nvim-treesitter", - lazy = false, - dependencies = "AstroNvim/astrocore", - branch = "main", - main = "nvim-treesitter", - 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, { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + treesitter = { + highlight = true, -- enable/disable treesitter based highlighting + indent = true, -- enable/disable treesitter based indentation + auto_install = true, -- enable/disable automatic installation of detected languages + ensure_installed = { "lua", + "vim", "cpp", "c", "bash", @@ -34,90 +40,8 @@ return { "typescript", "vimdoc", "xml" - }) - end, - config = function() - require("nvim-treesitter.configs").setup { - highlight = { - enable = true, - additional_vim_regex_highlighting = false - }, - ensure_installed = { - "lua", - "cpp", - "c", - "bash", - "vim", - "markdown", - "asm", - "cmake", - "css", - "html", - "javascript", - "printf", - "fish", - "git_config", - "git_rebase", - "gitcommit", - "gitignore", - "gitattributes", - "java", - "meson", - "ninja", - "python", - "sql", - "typescript", - "vimdoc", - "xml" - } - } - end + -- add more arguments for adding more treesitter parsers + }, + }, }, - -- init = function() - -- vim.api.nvim_create_autocmd('FileType', { - -- callback = function() - -- -- Enable treesitter highlighting and disable regex syntax - -- pcall(vim.treesitter.start) - -- -- Enable treesitter-based indentation - -- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" - -- end, - -- } - -- ) - -- local ensureInstalled = { - -- "lua", - -- "cpp", - -- "c", - -- "bash", - -- "vim", - -- "markdown", - -- "asm", - -- "cmake", - -- "css", - -- "html", - -- "javascript", - -- "printf", - -- "fish", - -- "git_config", - -- "git_rebase", - -- "gitcommit", - -- "gitignore", - -- "gitattributes", - -- "java", - -- "meson", - -- "ninja", - -- "python", - -- "sql", - -- "typescript", - -- "vimdoc", - -- "xml" - -- -- ... your parsers - -- } - -- local alreadyInstalled = require('nvim-treesitter.config').get_installed() - -- local parsersToInstall = vim.iter(ensureInstalled) - -- :filter(function(parser) - -- return not vim.tbl_contains(alreadyInstalled, parser) - -- end) - -- :totable() - -- require('nvim-treesitter').install(parsersToInstall) - -- end, } diff --git a/lua/plugins/user.lua b/lua/plugins/user.lua index acdbf63..c0e7b00 100644 --- a/lua/plugins/user.lua +++ b/lua/plugins/user.lua @@ -1,12 +1,91 @@ +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 +-- PLEASE REMOVE THE EXAMPLES YOU HAVE NO INTEREST IN BEFORE ENABLING THIS FILE +-- Here are some examples: + +---@type LazySpec return { - -- You can also add new plugins here as well: - -- Add plugins, the lazy syntax - -- "andweeb/presence.nvim", - -- { - -- "ray-x/lsp_signature.nvim", - -- event = "BufRead", - -- config = function() - -- require("lsp_signature").setup() - -- end, - -- }, + + -- == 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 dashboard options + { + "folke/snacks.nvim", + opts = { + dashboard = { + preset = { + header = table.concat({ + " █████ ███████ ████████ ██████ ██████ ", + "██ ██ ██ ██ ██ ██ ██ ██", + "███████ ███████ ██ ██████ ██ ██", + "██ ██ ██ ██ ██ ██ ██ ██", + "██ ██ ███████ ██ ██ ██ ██████ ", + "", + "███  ██ ██  ██ ██ ███  ███", + "████  ██ ██  ██ ██ ████  ████", + "██ ██  ██ ██  ██ ██ ██ ████ ██", + "██  ██ ██  ██  ██  ██ ██  ██  ██", + "██   ████   ████   ██ ██      ██", + }, "\n"), + }, + }, + }, + }, + + -- 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) + -- add more custom luasnip configuration such as filetype extend or custom snippets + local luasnip = require "luasnip" + luasnip.filetype_extend("javascript", { "javascriptreact" }) + + -- include the default astronvim config that calls the setup call + require "astronvim.plugins.configs.luasnip"(plugin, opts) + 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, + enabled = false, + }, } diff --git a/lua/polish.lua b/lua/polish.lua index 14c38cd..642719f 100644 --- a/lua/polish.lua +++ b/lua/polish.lua @@ -1,18 +1,5 @@ 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 +-- This will run last in the setup process. +-- This is just pure lua so anything that doesn't -- fit in the normal config locations above can go here - --- Set up custom filetypes -vim.filetype.add { - extension = { - foo = "fooscript", - }, - filename = { - ["Foofile"] = "fooscript", - }, - pattern = { - ["~/%.config/foo/.*"] = "fooscript", - }, -}