re-structure neovim plugins

also delete unused ones
This commit is contained in:
Alexander Navarro 2024-11-20 15:11:55 -03:00
parent ea5957f6d4
commit 071be15dc1
47 changed files with 155 additions and 274 deletions

View file

@ -0,0 +1,39 @@
return { -- Change colors.none if not using a transparent background
"catppuccin/nvim",
priority = 1000,
lazy = false,
opts = {
flavour = "macchiato",
transparent_background = true,
integrations = {
cmp = true,
notify = true,
harpoon = false,
mason = true,
neogit = true,
noice = true,
hop = true,
lsp_trouble = true,
indent_blankline = {
enabled = true,
},
},
custom_highlights = function(colors)
return {
-- Fix colors for cmp
Pmenu = { bg = colors.none, blend = 0 },
FloatBorder = { bg = colors.none },
CmpItemMenu = { fg = colors.text, bg = colors.none },
-- dadbod-ui
NotificationInfo = { bg = colors.none, fg = colors.text },
NotificationWarning = { bg = colors.none, fg = colors.yellow },
NotificationError = { bg = colors.none, fg = colors.red },
}
end,
},
config = function(_, opts)
require("catppuccin").setup(opts)
vim.cmd.colorscheme("catppuccin")
end,
}

View file

@ -0,0 +1,14 @@
return {
-- Detect tabstop and shiftwidth automatically
"tpope/vim-sleuth",
{ "nvim-tree/nvim-web-devicons", lazy = true },
{
-- Highlight word under cursor
"RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" },
opts = { delay = 200 },
config = function(_, opts)
require("illuminate").configure(opts)
end,
},
}

View file

@ -0,0 +1,85 @@
return {
"echasnovski/mini.clue",
version = "*",
event = "VeryLazy",
config = function()
local miniclue = require("mini.clue")
miniclue.setup({
triggers = {
-- Leader triggers
{ mode = "n", keys = "<Leader>" },
{ mode = "v", keys = "<Leader>" },
{ mode = "x", keys = "<Leader>" },
-- Built-in completion
{ mode = "i", keys = "<C-x>" },
-- `g` key
{ mode = "n", keys = "g" },
{ mode = "x", keys = "g" },
-- Marks
{ mode = "n", keys = "'" },
{ mode = "n", keys = "`" },
{ mode = "x", keys = "'" },
{ mode = "x", keys = "`" },
-- Registers
{ mode = "n", keys = '"' },
{ mode = "x", keys = '"' },
{ mode = "i", keys = "<C-r>" },
{ mode = "c", keys = "<C-r>" },
-- Window commands
{ mode = "n", keys = "<C-w>" },
-- `z` key
{ mode = "n", keys = "z" },
{ mode = "x", keys = "z" },
},
-- Add a "postkeys" value to activate those keys after others
clues = {
miniclue.gen_clues.builtin_completion(),
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
miniclue.gen_clues.registers(),
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
{ mode = "n", keys = "<Leader><Leader>", desc = "+Bookmarks" },
{ mode = "n", keys = "<Leader><Leader>n", postkeys = "<Leader><Leader>" },
{ mode = "n", keys = "<Leader><Leader>N", postkeys = "<Leader><Leader>" },
{ mode = "n", keys = "<Leader>b", desc = "+Buffers" },
{ mode = "n", keys = "<Leader>bh", postkeys = "<Leader>b" },
{ mode = "n", keys = "<Leader>bl", postkeys = "<Leader>b" },
{ mode = "n", keys = "<Leader>f", desc = "+Find" },
{ mode = "n", keys = "<Leader>g", desc = "+Git" },
{ mode = "n", keys = "<Leader>l", desc = "+LSP" },
{ mode = "n", keys = "<Leader>r", desc = "+Replace" },
{ mode = "n", keys = "<Leader>u", desc = "+UI & Config" },
{ mode = "n", keys = "<Leader>un", desc = "+Noice" },
{ mode = "n", keys = "<Leader>w", desc = "+Workspace" },
{ mode = "n", keys = "<Leader>p", desc = "+Run stuff" },
{ mode = "n", keys = "<Leader>z", desc = "+ZK" },
{ mode = "v", keys = "<Leader>z", desc = "+ZK" },
{ mode = "v", keys = "<Leader>a", desc = "+AI" },
{ mode = "n", keys = "<Leader>a", desc = "+AI" },
{ mode = "n", keys = "g?", desc = "+Print Debug" },
},
-- Clue window settings
window = {
-- Floating window config
config = {
width = "auto",
},
-- Delay before showing clue window
delay = 200,
-- Keys to scroll inside the clue window
scroll_down = "<C-d>",
scroll_up = "<C-u>",
},
})
end,
}

View file

@ -0,0 +1,230 @@
return {
"nvim-lualine/lualine.nvim",
lazy = false,
dependencies = {
"nvim-tree/nvim-web-devicons",
"cbochs/grapple.nvim",
{ 'AndreM222/copilot-lualine' }
},
opts = function()
local icons = require("aleidk.constants").icons
local palete = require("catppuccin.palettes").get_palette "macchiato"
local function diff_source()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end
local function position_scrollbar(str)
local sbar = { "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" }
local curr_line = vim.api.nvim_win_get_cursor(0)[1]
local lines = vim.api.nvim_buf_line_count(0)
local i = math.floor((curr_line - 1) / lines * #sbar) + 1
return str .. " " .. sbar[i]
end
local codecompanion_status = require("lualine.component"):extend()
codecompanion_status.processing = false
codecompanion_status.spinner_index = 1
local spinner_symbols = require("copilot-lualine.spinners").bouncing_bar
-- Initializer
function codecompanion_status:init(options)
codecompanion_status.super.init(self, options)
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
vim.api.nvim_create_autocmd({ "User" }, {
pattern = "CodeCompanionRequest*",
group = group,
callback = function(request)
if request.match == "CodeCompanionRequestStarted" then
self.processing = true
elseif request.match == "CodeCompanionRequestFinished" then
self.processing = false
end
end,
})
end
-- Function that runs every time statusline is updated
function codecompanion_status:update_status()
if self.processing then
self.spinner_index = (self.spinner_index % #spinner_symbols) + 1
return spinner_symbols[self.spinner_index]
else
return nil
end
end
return {
options = {
theme = "catppuccin",
globalstatus = true,
disabled_filetypes = { statusline = { "dashboard", "alpha" } },
component_separators = "",
section_separators = "",
},
sections = {
lualine_a = {
{
"mode",
padding = 0,
fmt = function()
return " "
end,
},
},
lualine_b = {},
lualine_c = {
{ "branch", icon = icons.git.branch },
{
"copilot",
cond = function()
return vim.bo.filetype ~= "codecompanion"
end,
show_colors = true,
symbols = {
status = {
icons = {
enabled = "",
sleep = "", -- auto-trigger disabled
disabled = "",
warning = "",
unknown = ""
},
hl = {
enabled = palete.teal,
sleep = palete.lavender,
disabled = palete.subtext0,
warning = palete.peach,
unknown = palete.red
}
},
spinners = spinner_symbols,
spinner_color = palete.mauve
},
},
{ codecompanion_status },
{
"overseer",
},
{
-- Macro recording status
function()
return require("noice").api.status.mode.get()
end,
cond = function()
return package.loaded["noice"] and require("noice").api.status.mode.has()
end,
},
},
lualine_x = {
{
function()
return require("grapple").statusline()
end,
},
},
lualine_y = {
{ "searchcount" },
{ "location" },
{
"progress",
fmt = position_scrollbar,
separator = " ",
padding = 0,
},
},
lualine_z = {},
},
winbar = {
lualine_b = {
{
"filename",
path = 1,
symbols = {
modified = "", -- Text to show when the buffer is modified
alternate_file = "#", -- Text to show to identify the alternate file
directory = "", -- Text to show when the buffer is a directory
},
},
},
lualine_y = {
{
"diff",
symbols = {
added = icons.git.added,
modified = icons.git.modified,
removed = icons.git.removed,
},
source = diff_source,
},
{
"diagnostics",
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warn,
info = icons.diagnostics.Info,
hint = icons.diagnostics.Hint,
},
},
},
},
inactive_winbar = {
lualine_b = {
{
"filename",
path = 1,
symbols = {
modified = "", -- Text to show when the buffer is modified
alternate_file = "#", -- Text to show to identify the alternate file
directory = "", -- Text to show when the buffer is a directory
},
},
},
lualine_y = {
{
"diff",
symbols = {
added = icons.git.added,
modified = icons.git.modified,
removed = icons.git.removed,
},
source = diff_source,
},
{
"diagnostics",
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warn,
info = icons.diagnostics.Info,
hint = icons.diagnostics.Hint,
},
},
},
},
extensions = {
"neo-tree",
"lazy",
"fugitive",
"fzf",
"man",
"mason",
"nvim-tree",
"quickfix",
"symbols-outline",
"trouble",
},
}
end,
}

View file

@ -0,0 +1,44 @@
return {
{
"MeanderingProgrammer/markdown.nvim",
name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons
opts = {
file_types = { 'markdown', 'codecompanion' },
sign = {
enabled = false,
},
},
},
{
"zk-org/zk-nvim",
config = function()
require("zk").setup({
picker = "select",
})
function MAP(mode, l, r, desc)
vim.keymap.set(mode, l, r, { desc = desc, silent = true })
end
MAP("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", "Open the link under cursor")
MAP("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
"Create new note")
MAP("v", "<leader>zN",
":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
"Create new note using selection as content")
MAP("n", "<leader>zl", "<Cmd>ZkInsertLink<CR>", "Insert Link into cursor position")
MAP("v", "<leader>zl", ":'<,'>ZkInsertLinkAtSelection<CR>", "Insert Link into selection")
MAP("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", "Backlinks")
MAP("n", "<leader>zo", "<Cmd>ZkLinks<CR>", "Outlinks")
MAP("n", "<leader>zf", "<Cmd>ZkNotes<CR>", "Find note")
MAP("n", "<leader>zt", "<Cmd>ZkTags<CR>", "Find tags")
end
}
}

View file

@ -0,0 +1,65 @@
-- Move to windows with Ctrl and hjkl
-- Resize to windows with Alt and hjkl
-- Tmux aware
return {
"mrjones2014/smart-splits.nvim",
opts = { ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" }, ignored_buftypes = { "nofile" } },
keys = {
{
"<C-h>",
function()
require("smart-splits").move_cursor_left()
end,
desc = "Move to left window",
},
{
"<C-j>",
function()
require("smart-splits").move_cursor_down()
end,
desc = "Move to bottom window",
},
{
"<C-k>",
function()
require("smart-splits").move_cursor_up()
end,
desc = "Move to upper window",
},
{
"<C-l>",
function()
require("smart-splits").move_cursor_right()
end,
desc = "Move to right window",
},
{
"<A-h>",
function()
require("smart-splits").resize_left()
end,
desc = "Move to left window",
},
{
"<A-j>",
function()
require("smart-splits").resize_down()
end,
desc = "Move to bottom window",
},
{
"<A-k>",
function()
require("smart-splits").resize_up()
end,
desc = "Move to upper window",
},
{
"<A-l>",
function()
require("smart-splits").resize_right()
end,
desc = "Move to right window",
},
},
}

View file

@ -0,0 +1,6 @@
return {
"echasnovski/mini.surround",
disabled = true,
version = "*",
opts = {},
}

View file

@ -0,0 +1,90 @@
-- Fuzzy Finder (files, lsp, etc)
return {
"nvim-telescope/telescope.nvim",
version = "*",
event = "VeryLazy",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{
-- Blazingly Fast Fuzzy Finder Algorithm for Telescope
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
},
config = function()
local actions = require("telescope.actions")
local telescope = require("telescope")
local builtin = require("telescope.builtin")
local opts = {
defaults = {
prompt_prefix = "",
selection_caret = "",
layout_strategy = "vertical",
layout_config = { vertical = { height = 0.99, mirror = true, prompt_position = "top" } },
mappings = {
i = {
["<c-u>"] = actions.preview_scrolling_up,
["<c-d>"] = actions.preview_scrolling_down,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-s>"] = actions.file_vsplit,
["<C-v>"] = actions.file_split,
["<ESC>"] = actions.close,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<c-t>"] = function(...)
return require("trouble.providers.telescope").open_with_trouble(...)
end,
["<a-t>"] = function(...)
return require("trouble.providers.telescope").open_selected_with_trouble(...)
end,
},
},
},
}
telescope.setup(opts)
-- Enable telescope fzf native, if installed
pcall(telescope.load_extension, "fzf")
-- Find files
vim.keymap.set(
"n",
"<leader>fe",
":Telescope file_browser path=%:p:h select_buffer=true<CR>",
{ desc = "File Explorer" }
)
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Find buffers" })
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find files" })
vim.keymap.set("n", "<leader>fF", function()
builtin.find_files({ hidden = true, no_ignore = true })
end, { desc = "Find all files" })
-- Search inside files
vim.keymap.set("n", "<leader>fw", builtin.grep_string, { desc = "Find word under cursor" })
vim.keymap.set("n", "<leader>fW", builtin.live_grep, { desc = "Find word (live grep)" })
-- Help
vim.keymap.set("n", "<leader>fc", builtin.command_history, { desc = "Find in commands history" })
vim.keymap.set("n", "<leader>fC", builtin.commands, { desc = "Find a command" })
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Find Help" })
vim.keymap.set("n", "<leader>fk", builtin.keymaps, { desc = "Find Keymaps" })
-- Git
vim.keymap.set("n", "<leader>gb", builtin.git_branches, { desc = "Change branch" })
-- Diagnosticos
-- Disabled, handle by trouble
-- vim.keymap.set("n", "<leader>fD", function()
-- builtin.diagnostics({ bufnr = 0 })
-- end, { desc = "Find diagnostics (Telescope)" })
-- vim.keymap.set("n", "<leader>fD", function()
-- builtin.diagnostics({ bufnr = nil })
-- end, { desc = "Find diagnostics in workspace (Telescope)" })
-- vim.keymap.set("n", "<leader>fz", builtin.spell_suggest, { desc = "Find spell suggestion" })
end,
}

View file

@ -0,0 +1,13 @@
return {
"folke/todo-comments.nvim",
cmd = { "TodoTrouble", "TodoTelescope" },
event = { "BufReadPost", "BufNewFile" },
config = true,
-- stylua: ignore
keys = {
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" },
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" },
{ "<leader>ft", "<cmd>TodoTrouble<cr>", desc = "Find todos (Trouble)" },
{ "<leader>fT", "<cmd>TodoTelescope<cr>", desc = "Find todos (Telescope)" },
},
}