♻️ refactor(full-scope)!: major revision refactoring

Code layout has been changed and improoved. Annotations are added for documentation. Automated through utility functions and data tables

BREAKING CHANGE: Tested from clean. Now properly uses LuaRocks to install dependencies.
This commit is contained in:
2024-09-04 16:07:12 -04:00
parent b2731cff01
commit 273580f533
48 changed files with 1962 additions and 750 deletions
+4 -6
View File
@@ -1,18 +1,16 @@
---@module "plugins.ai"
--- This module defines the AI plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ AI Tools │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
return {
{
{ --
-- Neocodeium
"monkoose/neocodeium",
event = "VeryLazy",
opts = {
manual = false,
silent = true,
debounce = false,
},
opts = data.types.neocodeium.opts,
keys = data.keys.neocodeium,
},
{ -- Copilot
-79
View File
@@ -1,79 +0,0 @@
-- ╭─────────────────────────────────────────────────────────╮
-- │ ALPHA │
-- ╰─────────────────────────────────────────────────────────╯
return {
"goolord/alpha-nvim",
event = "VimEnter",
enabled = true,
init = false,
opts = function()
local dashboard = require("alpha.themes.dashboard")
local logo = [[
██████╗ ██████╗ ██████╗ ████████╗██╗███████╗███████╗████████╗ ███╗ ██╗██╗ ██╗██╗███╗ ███╗
██╔══██╗██╔═══██╗██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝╚══██╔══╝ ████╗ ██║██║ ██║██║████╗ ████║
██████╔╝██║ ██║██║ ██║ ██║ ██║█████╗ ███████╗ ██║ ██╔██╗ ██║██║ ██║██║██╔████╔██║
██╔══██╗██║ ██║██║ ██║ ██║ ██║██╔══╝ ╚════██║ ██║  ██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║
██║ ██║╚██████╔╝╚██████╔╝ ██║ ██║███████╗███████║ ██║ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
]]
dashboard.section.header.val = vim.split(logo, "\n")
-- stylua: ignore start
dashboard.section.buttons.val = {
---@diagnostic disable: param-type-mismatch
dashboard.button("f", "" .. " Find file", LazyVim.pick()),
dashboard.button("n", "" .. " New file", [[<cmd> ene <BAR> startinsert <cr>]]),
dashboard.button("r", "" .. " Recent files", LazyVim.pick("oldfiles")),
dashboard.button("g", "" .. " Grep text", LazyVim.pick("live_grep")),
dashboard.button("z", "" .. " LazyGit", "<cmd> LazyGit <cr>"),
dashboard.button("c", "" .. " Config", LazyVim.pick.config_files()),
dashboard.button("s", "" .. " Restore Session", [[<cmd> lua require("persistence").load() <cr>]]),
dashboard.button("S", "󰢹 " .. " Remote Session", [[<cmd> lua require("config.rootiest").load_remote() <cr>]]),
dashboard.button("l", "󰒲 " .. " Lazy", "<cmd> Lazy <cr>"),
dashboard.button("q", "" .. " Quit", "<cmd> qa <cr>"),
}
-- stylua: ignore end
for _, button in ipairs(dashboard.section.buttons.val) do
button.opts.hl = "AlphaButtons"
button.opts.hl_shortcut = "AlphaShortcut"
end
dashboard.section.header.opts.hl = "AlphaHeader"
dashboard.section.buttons.opts.hl = "AlphaButtons"
dashboard.section.footer.opts.hl = "AlphaFooter"
dashboard.opts.layout[1].val = 10
return dashboard
end,
config = function(_, dashboard)
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = "AlphaReady",
callback = function()
require("lazy").show()
end,
})
end
require("alpha").setup(dashboard.opts)
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
dashboard.section.footer.val = "⚡ Neovim loaded "
.. stats.loaded
.. "/"
.. stats.count
.. " plugins in "
.. ms
.. "ms"
pcall(vim.cmd.AlphaRedraw)
end,
})
end,
}
+14 -14
View File
@@ -1,20 +1,20 @@
--- @module "plugins.astral"
--- This module defines the astral plugin spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Astral Plugin │
-- ╰─────────────────────────────────────────────────────────╯
return {
{
"rootiest/astral.nvim",
version = "*", -- Pin to GitHub releases
opts = {
fallback_themes = {
"catppuccin-macchiato",
"catppuccin-frappe",
"tokyonight",
"kanagawa",
"monochrome",
"default",
},
return { -- Astral
"rootiest/astral.nvim",
version = "*", -- Pin to GitHub releases
opts = {
fallback_themes = {
"catppuccin-macchiato",
"catppuccin-frappe",
"tokyonight",
"kanagawa",
"monochrome",
"default",
},
-- dev = true, -- Use local codebase
},
-- dev = true, -- Use local codebase
}
+127 -129
View File
@@ -1,145 +1,143 @@
--- @module "plugins.cmp"
--- This module defines the cmp plugin spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Auto Completion │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
return {
{
"hrsh7th/nvim-cmp",
-- HACK: Experiemental cmp performance fork
dev = true,
event = "VeryLazy",
dependencies = data.deps.cmp,
-- :
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local neocodeium = require("neocodeium")
local commands = require("neocodeium.commands")
return { --
"hrsh7th/nvim-cmp",
-- HACK: Experiemental cmp performance fork
dev = true,
event = "VeryLazy",
dependencies = data.deps.cmp,
-- :
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local neocodeium = require("neocodeium")
local commands = require("neocodeium.commands")
cmp.event:on("menu_opened", function()
neocodeium.clear()
end)
cmp.event:on("menu_opened", function()
neocodeium.clear()
end)
cmp.event:on("menu_closed", function()
commands.enable()
neocodeium.cycle_or_complete()
end)
cmp.event:on("menu_closed", function()
commands.enable()
neocodeium.cycle_or_complete()
end)
local border_opts = {
border = "rounded",
}
local window_opts = {
completion = cmp.config.window.bordered(border_opts),
documentation = cmp.config.window.bordered(border_opts),
}
luasnip.config.setup({})
local border_opts = {
border = "rounded",
}
local window_opts = {
completion = cmp.config.window.bordered(border_opts),
documentation = cmp.config.window.bordered(border_opts),
}
luasnip.config.setup({})
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = { completeopt = "menu,menuone,noinsert" },
window = vim.g.completion_round_borders_enabled and window_opts or {},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<Up>"] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Select,
}),
["<Down>"] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Select,
}),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete({}),
["<Tab>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = { completeopt = "menu,menuone,noinsert" },
window = vim.g.completion_round_borders_enabled and window_opts or {},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<Up>"] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Select,
}),
sources = {
{ name = "nvim_lsp", priority = 1000 },
{ name = "luasnip", priority = 750 },
{ name = "path", priority = 250 },
{ name = "buffer", priority = 250 },
{ name = "cmp_yanky" },
{ name = "dotenv" },
{ name = "calc" },
{ name = "conventionalcommits" },
{ name = "gitmoji", priority = 9998 },
{ name = "emoji", priority = 9999 },
},
formatting = {
fields = { "abbr", "kind", "menu" },
expandable_indicator = true,
format = function(entry, item)
local color_item = require("nvim-highlight-colors").format(
entry,
{ kind = item.kind }
)
item = require("lspkind").cmp_format({
require("tailwind-tools.cmp").lspkind_format,
})(entry, item)
if color_item.abbr_hl_group then
item.kind_hl_group = color_item.abbr_hl_group
item.kind = color_item.abbr
end
return item
end,
},
})
["<Down>"] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Select,
}),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete({}),
["<Tab>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp", priority = 1000 },
{ name = "luasnip", priority = 750 },
{ name = "path", priority = 250 },
{ name = "buffer", priority = 250 },
{ name = "cmp_yanky" },
{ name = "dotenv" },
{ name = "calc" },
{ name = "conventionalcommits" },
{ name = "gitmoji", priority = 9998 },
{ name = "emoji", priority = 9999 },
},
formatting = {
fields = { "abbr", "kind", "menu" },
expandable_indicator = true,
format = function(entry, item)
local color_item =
require("nvim-highlight-colors").format(entry, { kind = item.kind })
item = require("lspkind").cmp_format({
require("tailwind-tools.cmp").lspkind_format,
})(entry, item)
if color_item.abbr_hl_group then
item.kind_hl_group = color_item.abbr_hl_group
item.kind = color_item.abbr
end
return item
end,
},
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" },
},
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" },
},
}, { name = "cmp-cmdline-history" }, {
name = "cmp-cmdline-prompt",
}),
})
-- Additional setup for cmdline filetype
cmp.setup.filetype("cmdline", {
sources = {
{ name = "cmdline" }, -- Ensure 'cmdline' source is available
{ name = "path" },
{ name = "cmp-cmdline-history" },
{ name = "cmp-cmdline-prompt" },
},
})
}, { name = "cmp-cmdline-history" }, {
name = "cmp-cmdline-prompt",
}),
})
-- Custom filetype configuration
cmp.setup.filetype("config", {
sources = vim.tbl_filter(function(source)
return source.name ~= "emoji" and source.name ~= "gitmoji"
end, cmp.get_config().sources),
})
-- Additional setup for cmdline filetype
cmp.setup.filetype("cmdline", {
sources = {
{ name = "cmdline" }, -- Ensure 'cmdline' source is available
{ name = "path" },
{ name = "cmp-cmdline-history" },
{ name = "cmp-cmdline-prompt" },
},
})
-- List of filetypes to disable completion
local disabled_filetypes = data.types.cmp
for _, filetype in ipairs(disabled_filetypes) do
cmp.setup.filetype(filetype, {
sources = {},
})
end
end,
},
-- Custom filetype configuration
cmp.setup.filetype("config", {
sources = vim.tbl_filter(function(source)
return source.name ~= "emoji" and source.name ~= "gitmoji"
end, cmp.get_config().sources),
})
-- List of filetypes to disable completion
local disabled_filetypes = data.types.cmp
for _, filetype in ipairs(disabled_filetypes) do
cmp.setup.filetype(filetype, {
sources = {},
})
end
end,
}
+7 -26
View File
@@ -1,3 +1,5 @@
--- @module "plugins.coding"
--- This module defines the coding plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Coding │
-- ╰─────────────────────────────────────────────────────────╯
@@ -10,15 +12,9 @@ return {
automatic_installation = true,
},
},
{
{ --
"neovim/nvim-lspconfig",
opts = {
setup = {
clangd = function(_, opts)
opts.capabilities.offsetEncoding = { "utf-16" }
end,
},
},
opts = data.types.lspconfig.opts,
},
{ -- Yanky
import = "lazyvim.plugins.extras.coding.yanky",
@@ -32,13 +28,6 @@ return {
{ -- G-code
"wilriker/gcode.vim",
},
{ -- Mini Align
"echasnovski/mini.align",
event = "InsertEnter",
config = function()
require("mini.align").setup()
end,
},
{ -- Alternate
"ton/vim-alternate",
lazy = true,
@@ -57,16 +46,8 @@ return {
opts = data.types.substitute,
keys = data.keys.substitute,
},
{ -- mini.splitjoin
"echasnovski/mini.splitjoin",
event = "InsertEnter",
opts = {
mappings = data.keys.splitjoin,
},
},
{ -- mini-surround
"echasnovski/mini.surround",
opts = {},
keys = data.keys.surround,
{
"iamcco/markdown-preview.nvim",
build = "cd app && yarn install",
},
}
+7 -21
View File
@@ -1,38 +1,24 @@
--- @module "plugins.core"
--- This module defines the core plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Core │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
return {
require("config.rocks").plugin_spec,
{ -- LazyVim
"LazyVim/LazyVim",
opts = {
colorscheme = vim.g.my_colorscheme or "catppuccin-mocha",
news = {
lazyvim = true,
neovim = true,
},
},
},
{ -- Mini-animate
import = "lazyvim.plugins.extras.ui.mini-animate",
priority = 900,
opts = data.types.lazyvim.opts,
},
{ -- Bufferline
"akinsho/bufferline.nvim",
opts = {
options = data.types.bufferline,
},
opts = data.types.bufferline.opts,
},
{ -- Which-Key
"folke/which-key.nvim",
lazy = true,
opts = {
preset = "modern",
win = {
wo = {
winblend = 10,
},
},
},
opts = data.types.whichkey.opts,
},
}
+49
View File
@@ -0,0 +1,49 @@
--- @module "plugins.dashboard.alpha"
--- This module defines the alpha plugin spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ ALPHA │
-- ╰─────────────────────────────────────────────────────────╯
return { -- Alpha
"goolord/alpha-nvim",
event = "VimEnter",
enabled = true,
opts = require("data").dash.alpha.opts,
config = function(_, dashboard)
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = "AlphaReady",
callback = function()
require("lazy").show()
end,
})
end
-- Setup the dashboard
require("alpha").setup(dashboard.opts)
-- Open Alpha when Vim is started with no file arguments
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
-- If auto-cursorline is installed, disable it
if pcall(require, "auto-cursorline") then
require("auto-cursorline").disable({ buffer = true })
end
dashboard.section.footer.val = "⚡ Neovim loaded "
.. stats.loaded
.. "/"
.. stats.count
.. " plugins in "
.. ms
.. "ms"
pcall(vim.cmd.AlphaRedraw)
end,
})
end,
}
@@ -1,11 +1,12 @@
--- @module "plugins.dashboard.nvim-dashboard"
--- This module defines the dashboard plugin spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Dashboard │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
return {
return { --
-- Dashboard
enabled = false,
"nvimdev/dashboard-nvim",
event = "UIEnter",
version = false,
@@ -64,7 +65,7 @@ return {
file_height = logo_dimensions.height,
},
config = {
center = data.dash.choices,
center = data.dash.dashboard_nvim.choices,
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
@@ -110,4 +111,5 @@ return {
return opts
end,
enabled = false,
}
+6 -2
View File
@@ -1,3 +1,5 @@
--- @module "plugins.debug"
--- This module defines the debug plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Debug │
-- ╰─────────────────────────────────────────────────────────╯
@@ -13,8 +15,10 @@ return {
{ -- NeoTest
import = "lazyvim.plugins.extras.test.core",
},
{ "nvim-neotest/neotest-plenary" },
{
{ -- Neotest Plenary
"nvim-neotest/neotest-plenary",
},
{ -- Neotest
"nvim-neotest/neotest",
opts = {
adapters = data.deps.neotest.adapters,
+22 -30
View File
@@ -1,3 +1,5 @@
--- @module "plugins.editor"
--- This module defines the editor plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Editor │
-- ╰─────────────────────────────────────────────────────────╯
@@ -22,24 +24,10 @@ return {
{ -- Treesitter-context
import = "lazyvim.plugins.extras.ui.treesitter-context",
},
{ -- Mini.move
import = "lazyvim.plugins.extras.editor.mini-move",
},
{
{ -- Trouble
"folke/trouble.nvim",
cmd = data.cmd.trouble,
opts = {
modes = {
symbols = { -- Configure symbols mode
win = {
type = "split", -- split window
relative = "win", -- relative to current window
position = "right", -- right side
size = 0.3, -- 30% of the window
},
},
},
},
opts = data.types.trouble.opts,
},
{ -- Flash
"folke/flash.nvim",
@@ -48,6 +36,10 @@ return {
},
keys = data.keys.flash,
},
{
"nvim-neo-tree/neo-tree.nvim",
opts = data.types.neotree.opts,
},
{ -- Arrow
"otavioschwanck/arrow.nvim",
opts = data.types.arrow,
@@ -114,9 +106,7 @@ return {
},
{ -- Todo Comments
"folke/todo-comments.nvim",
opts = {
keywords = data.types.todo.keywords,
},
opts = data.types.todo.opts,
},
{ -- Rainbow Delimeters
"HiPhish/rainbow-delimiters.nvim",
@@ -125,24 +115,26 @@ return {
"nvim-zh/colorful-winsep.nvim",
opts = {
only_line_seq = false,
symbols = { "", "", "", "", "", "" },
no_exec_files = {
"packer",
"TelescopePrompt",
"mason",
"CompetiTest",
"NvimTree",
"neotree",
"lazy",
"neominimap",
},
symbols = data.types.colorful_winsep.symbols,
no_exec_files = data.types.colorful_winsep.no_exec_files,
},
event = { "WinLeave" },
},
{ -- Auto Cursorline
"delphinus/auto-cursorline.nvim",
enabled = data.func.check_global_var("auto_cursorline", true, true),
opts = {
wait_ms = 2000,
},
},
{ -- Bars N Lines
"OXY2DEV/bars-N-lines.nvim",
enabled = data.func.check_global_var(
"statuscolumn",
"barsNlines",
"native"
),
lazy = false,
config = data.types.barsNlines,
},
}
+4 -33
View File
@@ -1,3 +1,5 @@
--- @module "plugins.git"
--- This module defines the git plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Git Plugins │
-- ╰─────────────────────────────────────────────────────────╯
@@ -7,11 +9,6 @@ return {
{ -- Octo plugin
import = "lazyvim.plugins.extras.util.octo",
},
{ -- DiffView
"sindrets/diffview.nvim",
lazy = true,
cmd = data.cmd.diffview,
},
{ -- Gist Tools
"Rawnly/gist.nvim",
lazy = true,
@@ -33,9 +30,7 @@ return {
"jsongerber/thanks.nvim",
lazy = true,
cmd = data.cmd.thanks,
opts = {
star_on_install = false,
},
opts = data.types.thanks.opts,
},
{ -- GitLinker
"linrongbin16/gitlinker.nvim",
@@ -47,31 +42,7 @@ return {
{ -- Git Blame
"f-person/git-blame.nvim",
event = "VeryLazy",
opts = function()
-- Get the current lualine configuration
local config = require("lualine").get_config()
local git_blame = require("gitblame")
local funcs = data.func
-- Define the width limit for displaying the Git blame component
local width_limit = 245 -- Adjust this value as needed
-- Add Git-blame to lualine_c section
table.insert(config.sections.lualine_c, {
git_blame.get_current_blame_text,
cond = function() -- Only show if text is available
return git_blame.is_blame_text_available()
and funcs.is_window_wide_enough(width_limit)
end,
color = { fg = funcs.get_fg_color("GitSignsCurrentLineBlame") },
padding = { left = 1, right = 0 },
on_click = function()
vim.cmd("LazyGit")
end,
})
-- Apply the lualine configuration
require("lualine").setup(config)
-- Return the git-blame options
return data.types.gitblame
end,
opts = data.types.gitblame.opts,
},
{ -- Git Graph
"isakbm/gitgraph.nvim",
+54
View File
@@ -0,0 +1,54 @@
---@module "plugins"
--- This module defines the plugins for the Neovim configuration.
---
--- If lazy.nvim is installed, this module returns an empty table
--- to defer plugin management to lazy.nvim.
---
--- If lazy.nvim is not installed, the module loads each
--- Lua file in the `plugins` directory.
---
--- Note:
--- A warning will be triggered if lazy.nvim is not installed unless
--- the variable `vim.g.ignore_no_lazy` is set to `true`.
--
-- ╭─────────────────────────────────────────────────────────╮
-- │ PLUGINS DATA │
-- ╰─────────────────────────────────────────────────────────╯
local M = {}
-- Check if lazy.nvim is installed
if pcall(require, "lazy") then
-- If lazy.nvim is installed, return an empty table and do nothing
return M
else
-- If lazy.nvim is not installed and vim.g.ignore_no_lazy is not set, display a warning
if not vim.g.ignore_no_lazy then
require("data").func.notify("lazy.nvim is not installed", "WARNING")
end
-- Function to iterate over files in the directory and load them dynamically
local function read_plugins_dir()
-- Get the root path for the plugins directory
local dir_path =
vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h")
-- Open the directory
local files = vim.fn.readdir(dir_path)
for _, file in ipairs(files) do
-- Skip init.lua
if file ~= "init.lua" and file:match(".*%.lua$") then
-- Get the module name without the .lua extension
local plugin_name = file:sub(1, -5)
-- Load the plugin configuration file
require("plugins." .. plugin_name)
end
end
end
-- Read the directory and load plugin configuration files when lazy.nvim is not installed
read_plugins_dir()
end
return M
+2
View File
@@ -1,3 +1,5 @@
--- @module "plugins.languages"
--- This module defines the languages plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Languages │
-- ╰─────────────────────────────────────────────────────────╯
+42
View File
@@ -0,0 +1,42 @@
---@module "plugins.mini"
--- This module defines the mini plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Mini │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
return {
{ -- mini.animate
import = "lazyvim.plugins.extras.ui.mini-animate",
},
{ -- mini.move
import = "lazyvim.plugins.extras.editor.mini-move",
},
{ -- mini.align
"echasnovski/mini.align",
event = "InsertEnter",
config = function()
require("mini.align").setup()
end,
},
{ -- mini.splitjoin
"echasnovski/mini.splitjoin",
event = "InsertEnter",
opts = {
mappings = data.keys.splitjoin,
},
},
{ -- mini.surround
"echasnovski/mini.surround",
opts = {},
keys = function()
data.func.add_keymap(data.keys.surround)
end,
},
{ -- mini.files
"echasnovski/mini.files",
opts = data.types.minifiles.opts,
keys = data.keys.minifiles,
config = data.types.minifiles.config,
},
}
+29
View File
@@ -0,0 +1,29 @@
---@module "plugins.override"
--- This module defines the plugin spec overrides for the Neovim configuration.
--- This is used to prioritize certain plugins over others or to override
--- the default behavior of a core plugin.
---
-- ╭─────────────────────────────────────────────────────────╮
-- │ Overrides │
-- ╰─────────────────────────────────────────────────────────╯
return {
{ -- Override build for markdown-preview
"iamcco/markdown-preview.nvim",
priority = 1001,
build = "cd app && yarn install",
},
{ -- Prioritize dadbod
"kristijanhusak/vim-dadbod-completion",
priority = 1001,
dependencies = "vim-dadbod",
},
{ -- Prioritize dadbod
"kristijanhusak/vim-dadbod-ui",
priority = 1001,
dependencies = "vim-dadbod",
},
{ -- Prioritize dadbod
"tpope/vim-dadbod",
priority = 1002,
},
}
+21
View File
@@ -0,0 +1,21 @@
---@module "plugins.statusline.basic"
--- This module defines the basic statusline spec for the Neovim configuration.
--- This option uses the native statusline feature to create a basic statusline
---
--- Activate this module by setting the 'vim.g.statusline' variable to 'basic'
-- ╭─────────────────────────────────────────────────────────╮
-- │ BASIC │
-- ╰─────────────────────────────────────────────────────────╯
-- If basic statusline is not enabled, return an empty table
if vim.g.statusline ~= "basic" then
return {}
end
-- Set up the basic statusline
---TODO: Write a basic statusline configuration using the
--- native statusline feature.
-- No lazy.nvim plugin necessary
return {}
+19
View File
@@ -0,0 +1,19 @@
--- @module "plugins.statusline.heirline"
--- This module defines the heirline plugin spec for the Neovim configuration.
--- This option uses the heirline plugin to create a statusline for Neovim
---
--- Activate this module by setting the 'vim.g.statusline' variable to 'heirline'
-- ╭─────────────────────────────────────────────────────────╮
-- │ Heirline │
-- ╰─────────────────────────────────────────────────────────╯
local data = require("data")
return {
{
"rebelot/heirline.nvim",
enabled = data.func.check_global_var("statusline", "heirline", "lualine"),
event = "UIEnter",
opts = {},
},
}
@@ -1,13 +1,26 @@
--- @module "plugins.statusline.lualine"
--- This module defines the lualine plugin spec for the Neovim configuration.
--- This option uses the lualine plugin to create a statusline for Neovim
---
--- Activate this module by setting the 'vim.g.statusline' variable to 'lualine'
-- ╭─────────────────────────────────────────────────────────╮
-- │ Lualine │
-- ╰─────────────────────────────────────────────────────────╯
local utils = require("utils")
local wakatime_stats = require("utils.wakatime_stats")
local music_stats = require("utils.music_stats")
local data = require("data")
local funcs = data.func
return {
-- Use lualine by default
if vim.g.statusline == nil then
vim.g.statusline = "lualine"
end
return { -- Lualine
"nvim-lualine/lualine.nvim",
enabled = data.func.check_global_var("statusline", "lualine", "lualine"),
dependencies = data.deps.lualine,
init = function()
vim.g.lualine_laststatus = vim.o.laststatus
@@ -41,9 +54,11 @@ return {
},
sections = { -- Sections
lualine_a = {
{ -- Mode
"mode",
icon = data.types.logo.icon,
{
-- Calls the current.lualine() function to get the mode string
function()
return data.types.mode.current.lualine()
end,
padding = { left = 1, right = 0 },
},
},
@@ -128,7 +143,9 @@ return {
removed = icons.git.removed,
padding = { left = 0, right = 0 },
on_click = function()
vim.cmd("LazyGit")
if vim.g.statusline_clickable_git ~= false then
require("config.rootiest").toggle_lazygit_float()
end
end,
},
{ -- GitSigns
@@ -147,16 +164,18 @@ return {
end,
padding = { left = 0, right = 0 },
on_click = function()
vim.cmd("LazyGit")
if vim.g.statusline_clickable_git ~= false then
require("config.rootiest").toggle_lazygit_float()
end
end,
},
},
{ -- Wakatime
function()
return utils.wakatime_stats.get_icon_with_text()
return wakatime_stats.get_icon_with_text()
end,
color = function()
return utils.wakatime_stats.get_color()
return wakatime_stats.get_color()
end,
cond = function()
return funcs.is_window_wide_enough(100)
@@ -165,7 +184,7 @@ return {
},
{ -- Music
function()
return utils.music_stats.get_icon_with_text()
return music_stats.get_icon_with_text()
end,
cond = function()
return funcs.is_window_wide_enough(100)
+20
View File
@@ -0,0 +1,20 @@
---@module "plugins.statusline.none"
--- This module sets up the no-statusline optional mode for the Neovim configuration.
--- This option disables the statusline entirely for a more minimalistic appearance.
---
--- Activate this module by setting the 'vim.g.statusline' variable to 'none'
-- ╭─────────────────────────────────────────────────────────╮
-- │ No Statusline │
-- ╰─────────────────────────────────────────────────────────╯
if vim.g.statusline ~= "none" then
return {}
end
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ NO-STATUSLINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-- Set up the no-statusline
vim.o.laststatus = 0
-- No lazy.nvim plugin necessary
return {}
+10 -10
View File
@@ -1,15 +1,8 @@
---@module "plugins.terminal"
--- This module defines the terminal plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Terminals │
-- ╰─────────────────────────────────────────────────────────╯
-- package.path = package.path
-- .. ";"
-- .. vim.fn.expand("$HOME")
-- .. "/.luarocks/share/lua/5.1/?/init.lua"
-- package.path = package.path
-- .. ";"
-- .. vim.fn.expand("$HOME")
-- .. "/.luarocks/share/lua/5.1/?.lua"
local data = require("data")
return {
@@ -24,7 +17,14 @@ return {
config = function()
require("image").setup()
end,
cond = vim.g.useimage and not vim.g.neovide,
cond = function()
-- Disable image rendering in Neovide
-- or when vim.g.useimage = false
if vim.g.useimage == false then
return false
end
return not vim.g.neovide
end,
},
{ -- ToggleTerm
"akinsho/toggleterm.nvim",
+2
View File
@@ -1,3 +1,5 @@
--- @module "plugins.themes"
--- This module defines the themes plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Themes │
-- ╰─────────────────────────────────────────────────────────╯
+10 -1
View File
@@ -1,3 +1,5 @@
--- @module "plugins.util"
--- This module defines the utility plugins spec for the Neovim configuration.
-- ╭─────────────────────────────────────────────────────────╮
-- │ Utilities │
-- ╰─────────────────────────────────────────────────────────╯
@@ -27,6 +29,7 @@ return {
},
{ -- Auto-save
"okuuva/auto-save.nvim",
enabled = data.func.check_global_var("auto_save", true, true),
cmd = data.cmd.autosave,
event = { "InsertLeave", "TextChanged" },
opts = {
@@ -55,6 +58,7 @@ return {
},
{ -- Codesnap
"mistricky/codesnap.nvim",
enabled = data.func.check_global_var("codesnap", true, true),
lazy = true,
build = "make",
opts = {
@@ -89,6 +93,7 @@ return {
},
{ -- Music Controls
"AntonVanAssche/music-controls.nvim",
enabled = data.func.check_global_var("usemusic", true, true),
dependencies = data.deps.musiccontrols,
opts = {
default_player = "YoutubeMusic",
@@ -129,6 +134,10 @@ return {
{ -- Suda
"lambdalisue/vim-suda",
cmd = data.cmd.suda,
config = function()
vim.g.suda_smart_edit = 1
vim.cmd("let g:suda#prompt = '  Enter Sudo Password  '")
end,
},
{ -- Spell checker
"matkrin/telescope-spell-errors.nvim",
@@ -137,7 +146,7 @@ return {
end,
dependencies = data.deps.needs_telescope,
},
{
{ --
"Pheon-Dev/pigeon",
config = data.types.pigeon,
},