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

419 lines
18 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 {
-- == Examples of Adding Plugins ==
"andweeb/presence.nvim",
{
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function() require("lsp_signature").setup() end,
},
"lambdalisue/vim-suda",
"folke/lsp-colors.nvim",
"dstein64/nvim-scrollview",
-- == 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,
},
-- {
-- "saghen/blink.cmp",
-- -- -- optional: provides snippets for the snippet source
-- -- dependencies = { "rafamadriz/friendly-snippets" },
-- --
-- -- -- use a release tag to download pre-built binaries
-- -- version = "1.*",
-- -- -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- -- -- build = "cargo build --release",
-- -- -- If you use nix, you can build from source using latest nightly rust with:
-- -- -- build = 'nix run .#build-plugin',
-- --
-- ---@module 'blink.cmp'
-- ---@type blink.cmp.Config
-- opts = {
-- -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
-- -- 'super-tab' for mappings similar to vscode (tab to accept)
-- -- 'enter' for enter to accept
-- -- 'none' for no mappings
-- keymap = {
-- -- set to 'none' to disable the 'default' preset
-- preset = "super-tab",
--
-- ["<C-k>"] = { "select_prev", "fallback" },
-- ["<C-j>"] = { "select_next", "fallback" },
-- ["<C-q>"] = { "hide", "fallback" },
--
-- -- disable a keymap from the preset
-- ["<C-e>"] = {},
-- ["<C-p>"] = {},
-- ["<C-n>"] = {},
--
-- -- show with a list of providers
-- -- ["<C-space>"] = {
-- -- function(cmp)
-- -- cmp.show({ providers = { "snippets" } })
-- -- end,
-- -- },
--
-- -- control whether the next command will be run when using a function
-- -- ["<C-n>"] = {
-- -- function(cmp)
-- -- if some_condition then
-- -- return
-- -- end -- runs the next command
-- -- return true -- doesn't run the next command
-- -- end,
-- -- "select_next",
-- -- },
-- },
--
-- -- appearance = {
-- -- -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- -- -- Adjusts spacing to ensure icons are aligned
-- -- nerd_font_variant = "mono",
-- --
-- -- -- highlight_ns = vim.api.nvim_create_namespace("nvim-cmp"),
-- -- -- Sets the fallback highlight groups to nvim-cmp's highlight groups
-- -- -- Useful for when your theme doesn't support blink.cmp
-- -- -- Will be removed in a future release
-- --
-- -- use_nvim_cmp_as_default = true,
-- -- },
--
-- -- (Default) Only show the documentation popup when manually triggered
-- completion = {
-- keyword = { range = "full" },
-- -- trigger = {
-- -- When true, will prefetch the completion items when entering insert mode
-- -- prefetch_on_insert = false,
--
-- -- When false, will not show the completion window automatically when in a snippet
-- -- show_in_snippet = true,
--
-- -- When true, will show the completion window after typing any of alphanumerics, `-` or `_`
-- -- show_on_keyword = true,
--
-- -- When true, will show the completion window after typing a trigger character
-- -- show_on_trigger_character = true,
--
-- -- LSPs can indicate when to show the completion window via trigger characters
-- -- however, some LSPs (i.e. tsserver) return characters that would essentially
-- -- always show the window. We block these by default.
-- -- show_on_blocked_trigger_characters = { " ", "\n", "\t" },
-- -- You can also block per filetype with a function:
-- -- show_on_blocked_trigger_characters = function(ctx)
-- -- if vim.bo.filetype == "markdown" then
-- -- return { " ", "\n", "\t", ".", "/", "(", "[" }
-- -- end
-- -- return { " ", "\n", "\t" }
-- -- end,
--
-- -- When both this and show_on_trigger_character are true, will show the completion window
-- -- when the cursor comes after a trigger character after accepting an item
-- -- show_on_accept_on_trigger_character = true,
--
-- -- When both this and show_on_trigger_character are true, will show the completion window
-- -- when the cursor comes after a trigger character when entering insert mode
-- -- show_on_insert_on_trigger_character = true,
--
-- -- List of trigger characters (on top of `show_on_blocked_trigger_characters`) that won't trigger
-- -- the completion window when the cursor comes after a trigger character when
-- -- entering insert mode/accepting an item
-- -- show_on_x_blocked_trigger_characters = { "'", '"', "(" },
-- -- or a function, similar to show_on_blocked_trigger_character
-- -- },
-- list = {
-- -- Maximum number of items to display
-- max_items = 128,
--
-- selection = {
-- -- When `true`, will automatically select the first item in the completion list
-- preselect = true,
-- -- preselect = function(ctx) return vim.bo.filetype ~= 'markdown' end,
--
-- -- When `true`, inserts the completion item automatically when selecting it
-- -- You may want to bind a key to the `cancel` command (default <C-e>) when using this option,
-- -- which will both undo the selection and hide the completion menu
-- auto_insert = false,
-- -- auto_insert = function(ctx) return vim.bo.filetype ~= 'markdown' end
-- },
--
-- cycle = {
-- -- When `true`, calling `select_next` at the _bottom_ of the completion list
-- -- will select the _first_ completion item.
-- from_bottom = true,
-- -- When `true`, calling `select_prev` at the _top_ of the completion list
-- -- will select the _last_ completion item.
-- from_top = true,
-- },
-- },
--
-- -- documentation = {
-- -- auto_show = false,
-- -- auto_show_delay_ms = 230,
-- -- update_delay_ms = 50,
-- -- treesitter_highlighting = false,
-- -- draw = function(opts) opts.default_implementation() end,
-- -- window = {
-- -- min_width = 16,
-- -- max_width = 80,
-- -- max_height = 24,
-- -- border = "padded", -- Defaults to `vim.o.winborder` on nvim 0.11+ or 'padded' when not defined/<=0.10
-- -- winblend = 0,
-- -- winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,EndOfBuffer:BlinkCmpDoc",
-- -- -- Note that the gutter will be disabled when border ~= 'none'
-- -- scrollbar = true,
-- -- },
-- -- },
-- -- ghost_text = {
-- -- enabled = true,
-- -- show_with_selection = true,
-- -- show_without_selection = false,
-- -- show_with_menu = true,
-- -- show_without_menu = false,
-- -- },
-- -- ─────────────────────────────────< mini-icons config >──────────────────────────────
-- -- menu = {
-- -- enabled = true,
-- -- min_width = 16,
-- -- max_height = 10,
-- -- border = nil, -- Defaults to `vim.o.winborder` on nvim 0.11+
-- -- winblend = 0,
-- -- winhighlight = "Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None",
-- -- -- Keep the cursor X lines away from the top/bottom of the window
-- -- scrolloff = 2,
-- -- -- Note that the gutter will be disabled when border ~= 'none'
-- -- scrollbar = true,
-- -- -- Which directions to show the window,
-- -- -- falling back to the next direction when there's not enough space
-- -- direction_priority = { "s", "n" },
-- --
-- -- -- Whether to automatically show the window when new completion items are available
-- -- auto_show = true,
-- --
-- -- draw = {
-- -- -- Aligns the keyword you've typed to a component in the menu
-- -- align_to = "label", -- or 'none' to disable, or 'cursor' to align to the cursor
-- -- -- Left and right padding, optionally { left, right } for different padding on each side
-- -- padding = 1,
-- -- -- Gap between columns
-- -- gap = 2,
-- -- -- Use treesitter to highlight the label text for the given list of sources
-- -- -- treesitter = {},
-- -- treesitter = { "lsp" },
-- -- columns = { { "kind_icon" }, { "label", "label_description", gap = 1 } },
-- -- components = {
-- -- label = {
-- -- text = function(ctx) return require("colorful-menu").blink_components_text(ctx) end,
-- -- highlight = function(ctx) return require("colorful-menu").blink_components_highlight(ctx) end,
-- -- },
-- -- kind_icon = {
-- -- text = function(ctx)
-- -- local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
-- -- return kind_icon
-- -- end,
-- -- -- (optional) use highlights from mini.icons
-- -- highlight = function(ctx)
-- -- local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
-- -- return hl
-- -- end,
-- -- },
-- --
-- -- -- kind = {
-- -- -- -- (optional) use highlights from mini.icons
-- -- -- highlight = function(ctx)
-- -- -- local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
-- -- -- return hl
-- -- -- end,
-- -- -- },
-- --
-- -- label_description = {
-- -- width = { max = 30 },
-- -- text = function(ctx) return ctx.label_description end,
-- -- highlight = "BlinkCmpLabelDescription",
-- -- },
-- --
-- -- source_name = {
-- -- width = { max = 30 },
-- -- text = function(ctx) return ctx.source_name end,
-- -- highlight = "BlinkCmpSource",
-- -- },
-- --
-- -- source_id = {
-- -- width = { max = 30 },
-- -- text = function(ctx) return ctx.source_id end,
-- -- highlight = "BlinkCmpSource",
-- -- },
-- -- },
-- -- },
-- -- },
-- },
--
-- -- Default list of enabled providers defined so that you can extend it
-- -- elsewhere in your config, without redefining it, due to `opts_extend`
-- sources = {
-- default = { "lsp", "path", "snippets", "buffer" },
-- },
--
-- -- snippets = { preset = "default" | "luasnip" },
--
-- -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
-- -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
-- -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
-- --
-- -- See the fuzzy documentation for more information
-- fuzzy = {
-- implementation = "prefer_rust",
--
-- -- Frecency tracks the most recently/frequently used items and boosts the score of the item
-- -- Note, this does not apply when using the Lua implementation.
-- use_frecency = true,
--
-- -- Proximity bonus boosts the score of items matching nearby words
-- -- Note, this does not apply when using the Lua implementation.
-- use_proximity = true,
--
-- -- UNSAFE!! When enabled, disables the lock and fsync when writing to the frecency database. This should only be used on unsupported platforms (i.e. alpine termux)
-- -- Note, this does not apply when using the Lua implementation.
-- use_unsafe_no_lock = false,
-- sorts = {
-- -- (optionally) always prioritize exact matches
-- -- 'exact',
--
-- -- pass a function for custom behavior
-- -- function(item_a, item_b)
-- -- return item_a.score > item_b.score
-- -- end,
--
-- "score",
-- "sort_text",
-- },
-- },
-- },
-- opts_extend = { "sources.default" },
-- },
{
{
"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>"),
},
-- -@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>",
},
},
},
}