nvim-astro/lua/plugins/user.lua
2025-03-28 13:21:10 +01:00

322 lines
11 KiB
Lua
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 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 {
-- disable plugins
-- disable neo-tree
{ "nvim-neo-tree/neo-tree.nvim", enabled = false },
-- override plugin settings
"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 = true },
-- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
{
"L3MON4D3/LuaSnip",
config = function(plugin, opts)
-- include the default astronvim config that calls the setup call
require "astronvim.plugins.configs.luasnip"(plugin, opts)
-- load snippets paths
require("luasnip.loaders.from_vscode").lazy_load {
paths = { vim.fn.stdpath "config" .. "/snippets" },
}
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 <cr>
:with_cr(cond.none()),
},
-- disable for .vim files, but it work for another filetypes
Rule("a", "a", "-vim")
)
end,
},
-- set new/missing plugins
"lambdalisue/vim-suda",
"folke/lsp-colors.nvim",
"dstein64/nvim-scrollview",
-- vim maximizer
{
"szw/vim-maximizer",
keys = {
{ "<C-f>", "<cmd>MaximizerToggle<CR>", desc = "Maximize/minimize a split" },
},
},
-- snippets creation and management with scissors
{
{
"chrisgrieser/nvim-scissors",
lazy = false,
dependencies = { "nvim-telescope/telescope.nvim", "garymjr/nvim-snippets" },
opts = {
snippetDir = "~/.config/nvim/snippets", -- <- i have this as a submodule in my neovim config to have a seperate repo https://git.k4li.de/dotfiles/nvim-snippets.git
},
},
-- ──────────────────────────< keybindings for snippets engine >───────────────────────
vim.keymap.set("n", "<leader>sm", "<CMD>:ScissorsEditSnippet<cr>"),
vim.keymap.set("v", "<leader>sa", "<CMD>:ScissorsAddNewSnippet<cr>"),
},
-- mini plugins
{
-- mini-ai for a and i selections or other --> vin" for visual in next ""
{
"echasnovski/mini.ai",
version = "false",
opts = {},
},
-- ─< mini-surround for surrounding words or lines with "" or () or '' etc.. >──────────
{
"echasnovski/mini.surround",
version = "false",
opts = {},
},
-- ─< miniIcons >───────────────────────────────────────────────────────────────────────
{
"echasnovski/mini.icons",
version = "false",
opts = {},
lazy = true,
specs = {
{ "nvim-tree/nvim-web-devicons", enabled = false, optional = true },
},
init = function()
package.preload["nvim-web-devicons"] = function()
require("mini.icons").mock_nvim_web_devicons()
return package.loaded["nvim-web-devicons"]
end
end,
},
},
-- ╭─────────────────────────────────────╮
-- │ ╭───────────────╮ │
-- │ │ comment boxes │<- yes, those ones │
-- │ ╰───────────────╯ │
-- ╰─────────────────────────────────────╯
{
"LudoPinelli/comment-box.nvim",
lazy = false,
opts = {
comment_style = "line",
doc_width = 90, -- width of the document
box_width = 75, -- width of the boxes
line_width = 120, -- width of the lines
},
-- ───────────────────────────────< keymaps - commentboxes >───────────────────────────────
vim.keymap.set(
"n",
"<leader>cd",
"<Cmd>CBd<CR>",
{ noremap = true, silent = true, desc = "[c]ommentbox [d]elete" }
),
vim.keymap.set(
"v",
"<leader>cd",
"<Cmd>CBd<CR>",
{ noremap = true, silent = true, desc = "[c]ommentbox [d]elete" }
),
vim.keymap.set(
"n",
"<leader>cy",
"<Cmd>CBy<CR>",
{ noremap = true, silent = true, desc = "[y]ank content of Commentbox" }
),
vim.keymap.set(
"v",
"<leader>cy",
"<Cmd>CBy<CR>",
{ noremap = true, silent = true, desc = "[y]ank content of Commentbox" }
),
vim.keymap.set(
"n",
"<leader>cb",
"<Cmd>CBlabox1<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [b]ox" }
),
vim.keymap.set(
"v",
"<leader>cb",
"<Cmd>CBlabox1<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [b]ox" }
),
vim.keymap.set(
"n",
"<leader>cB",
"<Cmd>CBcabox1<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [b]ox (centered)" }
),
vim.keymap.set(
"v",
"<leader>cB",
"<Cmd>CBcabox1<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [b]ox (centered)" }
),
vim.keymap.set(
"n",
"<leader>cc",
"<Cmd>CBllbox14<CR>",
{ noremap = true, silent = true, desc = "[c]reate [c]omment" }
),
vim.keymap.set(
"v",
"<leader>cc",
"<Cmd>CBllbox14<CR>",
{ noremap = true, silent = true, desc = "[c]reate [c]omment" }
),
vim.keymap.set(
"n",
"<leader>cC",
"<Cmd>CBclbox14<CR>",
{ noremap = true, silent = true, desc = "[c]reate [c]omment (C)entered" }
),
vim.keymap.set(
"v",
"<leader>cC",
"<Cmd>CBclbox14<CR>",
{ noremap = true, silent = true, desc = "[c]reate [c]omment (C)entered" }
),
vim.keymap.set(
"n",
"<leader>cl",
"<Cmd>CBllline8<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [l]ine" }
),
vim.keymap.set(
"n",
"<leader>cL",
"<Cmd>CBlcline8<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [L]ine" }
),
},
-- yazi file manager
---@type LazySpec
{
"mikavilpas/yazi.nvim",
event = "VeryLazy",
keys = {
-- 👇 in this section, choose your own keymappings!
-- {
-- "<leader>lf",
-- "<cmd>Yazi<cr>",
-- desc = "Open yazi at the current file",
-- },
{
-- Open in the current working directory
"<leader>tLf",
"<cmd>Yazi cwd<cr>",
desc = "Open the file manager in nvim's working directory",
},
{
-- NOTE: this requires a version of yazi that includes
-- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18
"<leader>tlf",
"<cmd>Yazi toggle<cr>",
desc = "Resume the last yazi session",
},
},
---@type YaziConfig
opts = {
-- if you want to open yazi instead of netrw, see below for more info
open_for_directories = true,
keymaps = {
show_help = "<f1>",
},
},
},
-- ╭──────────────────────────────╮
-- │ renaming (also project wide) │
-- ╰──────────────────────────────╯
{
"MagicDuck/grug-far.nvim",
opts = { headerMaxWidth = 80 },
cmd = "GrugFar",
-- ────────────────────────────────────< keybindings >─────────────────────────────────
keys = {
{
"<leader>sr",
function()
local grug = require "grug-far"
local ext = vim.bo.buftype == "" and vim.fn.expand "%:e"
grug.grug_far {
transient = true,
prefills = {
filesFilter = ext and ext ~= "" and "*." .. ext or nil,
},
}
end,
mode = { "n", "v" },
desc = "Search and Replace",
},
},
},
}