feat(lazy): allow for hot loading plugin specs

This commit is contained in:
2024-04-21 03:20:28 +02:00
parent 2e36ef05d9
commit ac1e40bfee
31 changed files with 683 additions and 831 deletions
+22 -11
View File
@@ -1,4 +1,4 @@
local module_name = "core" vim.loader.enable()
local utils = require("utils") local utils = require("utils")
@@ -15,8 +15,8 @@ for _, file in ipairs(files) do
local pkg = "core." .. file local pkg = "core." .. file
local ok, err = pcall(require, pkg) local ok, err = pcall(require, pkg)
if not ok then if not ok then
utils.err("Error while loading package " .. pkg, module_name) utils.err("Error while loading package " .. pkg)
utils.err(err, module_name) utils.err(err)
return return
end end
end end
@@ -26,15 +26,26 @@ if vim.g.vscode then
else else
local ok, err = pcall(require, "bootstrap") local ok, err = pcall(require, "bootstrap")
if not ok then if not ok then
utils.err("Error during bootstrap", module_name) utils.err("Error during bootstrap")
utils.err(err:gsub("\t", " "), module_name) utils.err(err:gsub("\t", " "))
return return
end end
ok, err = pcall(require, "plugins") ---@type LazyPluginSpec[]
if not ok then local plugins = {
utils.err("Error while loading plugins", module_name) {
utils.err(err:gsub("\t", " "), module_name) "neovim/nvim-lspconfig",
return config = require("lsp").setup,
end },
{ import = "plugins" },
}
---@type LazyConfig
local opts = {
install = {
colorscheme = { "moonfly" },
},
}
require("lazy").setup(plugins, opts)
end end
+8 -1
View File
@@ -1,6 +1,13 @@
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
desc = "Use tabs for indents in Go files",
pattern = "go", pattern = "go",
callback = function () callback = function()
vim.bo.expandtab = false vim.bo.expandtab = false
end, end,
}) })
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
desc = "Return cursor to last position when re-opening a buffer",
pattern = "*",
command = 'silent! normal! g`"zv',
})
+21
View File
@@ -183,6 +183,11 @@ function M:on_attach(client, bufnr)
{ border = "single" }) { border = "single" })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.handlers["textDocument/signatureHelp"] =
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" }) vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
---@alias lsp.Client vim.lsp.Client
-- require("lsp_compl").attach(client, bufnr, {
-- server_side_fuzzy_completion = true,
-- })
end end
--- Configure the LSP client --- Configure the LSP client
@@ -203,6 +208,22 @@ function M:configure_client()
capabilities = vim.tbl_deep_extend("force", capabilities, capabilities = vim.tbl_deep_extend("force", capabilities,
cmp_nvim_lsp.default_capabilities()) cmp_nvim_lsp.default_capabilities())
end end
-- local epo = utils.try_require("epo")
-- if epo then
-- capabilities = vim.tbl_deep_extend(
-- "force",
-- capabilities,
-- epo.register_cap()
-- )
-- end
-- local lsp_compl = utils.try_require("lsp_compl")
-- if lsp_compl then
-- capabilities = vim.tbl_deep_extend("force", capabilities, lsp_compl.capabilities())
-- end
--
self.config.lspconfig.capabilities = capabilities self.config.lspconfig.capabilities = capabilities
self.config.lspconfig.on_attach = function(client, bufnr) self.config.lspconfig.on_attach = function(client, bufnr)
local ok, ret = pcall(self.on_attach, self, client, bufnr) local ok, ret = pcall(self.on_attach, self, client, bufnr)
-203
View File
@@ -1,203 +0,0 @@
vim.loader.enable()
---@type LazyPluginSpec[]
local plugins = {
{
"bluz71/vim-moonfly-colors",
priority = 1000,
lazy = false,
name = "moonfly",
config = require("plugins.moonfly"),
},
--[[ {
"catppuccin/nvim",
name = "catppuccin",
priority = 100,
lazy = false,
config = require("plugins.catppuccin"),
}, ]]
--[[ {
"navarasu/onedark.nvim",
priority = 1000,
lazy = false,
-- name = "moonfly",
config = require("plugins.onedark"),
}, ]]
{
"rcarriga/nvim-notify",
priority = 900,
lazy = false,
config = require("plugins.notify"),
},
{
"rafamadriz/friendly-snippets",
},
{
"L3MON4D3/LuaSnip",
config = require("plugins.luasnip"),
-- comment out on windows and install jsregexp manually
build = (require("utils").os_name ~= "Windows_NT" and "make install_jsregexp" or nil),
version = "2.*",
},
{
"saadparwaiz1/cmp_luasnip",
},
{
"hrsh7th/cmp-path",
},
{
"hrsh7th/cmp-cmdline",
},
{
"hrsh7th/cmp-nvim-lsp",
},
{
"hrsh7th/nvim-cmp",
config = require("plugins.cmp"),
},
{
"onsails/lspkind.nvim",
config = require("plugins.lspkind"),
},
{
"williamboman/mason.nvim",
config = require("plugins.mason"),
lazy = true,
event = "VimEnter",
},
{
"neovim/nvim-lspconfig",
config = require("lsp").setup,
},
{
"nvim-treesitter/nvim-treesitter",
config = require("plugins.treesitter"),
build = ":TSUpdate",
lazy = true,
event = "VimEnter",
},
{
"tpope/vim-fugitive",
config = require("plugins.fugitive"),
lazy = true,
event = "VimEnter",
},
{
"rbong/vim-flog",
config = require("plugins.flog"),
},
{
"nvim-lualine/lualine.nvim",
config = require("plugins.lualine"),
lazy = true,
event = "VimEnter",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
},
{
"lewis6991/gitsigns.nvim",
config = require("plugins.gitsigns"),
lazy = true,
event = "VimEnter",
},
{
"nvim-telescope/telescope.nvim",
config = require("plugins.telescope"),
lazy = true,
event = "VimEnter",
dependencies = {
"nvim-lua/plenary.nvim",
},
},
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release"
.. " && cmake --build build --config Release"
.. " && cmake --install build --prefix build",
},
{
"numToStr/Comment.nvim",
config = require("plugins.comment"),
lazy = true,
event = "VimEnter",
},
{
"simeji/winresizer",
config = require("plugins.winresizer"),
lazy = true,
keys = { "<C-W>r" },
},
{
"sindrets/winshift.nvim",
config = require("plugins.winshift"),
lazy = true,
keys = { "<C-W>m" },
},
{
"dstein64/vim-startuptime",
lazy = true,
event = "VimEnter",
},
{
"famiu/bufdelete.nvim",
config = require("plugins.bufdelete"),
},
{
"nvim-treesitter/nvim-treesitter-context",
config = require("plugins.treesitter-context"),
},
{
"fedepujol/move.nvim",
config = require("plugins.move"),
},
{
"nvim-orgmode/orgmode",
config = require("plugins.orgmode"),
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
},
{
"farmergreg/vim-lastplace",
},
{
"sindrets/diffview.nvim",
config = require("plugins.diffview"),
dependencies = {
"nvim-tree/nvim-web-devicons",
},
},
{
"j-hui/fidget.nvim",
tag = "legacy",
event = "LspAttach",
config = require("plugins.fidget"),
},
{
"lvimuser/lsp-inlayhints.nvim",
branch = "anticonceal",
config = require("plugins.lsp-inlayhints"),
},
{
"cbochs/grapple.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = require("plugins.grapple"),
},
{
"is0n/fm-nvim",
config = require("plugins.fm-nvim"),
},
{
"NvChad/nvim-colorizer.lua",
config = require("plugins.nvim-colorizer"),
},
}
local opts = {
install = {
colorscheme = { "moonfly" },
},
}
require("lazy").setup(plugins, opts)
+7 -10
View File
@@ -1,12 +1,9 @@
-- https://github.com/famiu/bufdelete.nvim -- https://github.com/famiu/bufdelete.nvim
local function setup() ---@type LazyPluginSpec
vim.keymap.set( return {
"n", "famiu/bufdelete.nvim",
"<C-w>q", keys = {
vim.cmd.Bwipeout, { "<C-w>q", vim.cmd.Bwipeout, { remap = false, silent = true }, mode = "n" },
{ remap = false, silent = true, } },
) }
end
return setup
+104 -93
View File
@@ -24,101 +24,112 @@ local function has_words_after()
~= nil ~= nil
end end
local function setup() ---@type LazyPluginSpec
local utils = require("utils") return {
local cmp = require("cmp") "hrsh7th/nvim-cmp",
local luasnip = require("luasnip") dependencies = {
local lspkind = utils.try_require("lspkind") "saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-path",
local opt = { "hrsh7th/cmp-cmdline",
preselect = cmp.PreselectMode.None, "hrsh7th/cmp-nvim-lsp",
completion = { keyword_length = 0 }, {
snippet = { "L3MON4D3/LuaSnip",
expand = function(args) config = function()
luasnip.lsp_expand(args.body) require("luasnip.loaders.from_vscode").lazy_load()
end, end,
build = (require("utils").os_name ~= "Windows_NT" and "make install_jsregexp" or nil),
version = "2.*",
}, },
formatting = { },
format = function(entry, vim_item) config = function()
if lspkind then local cmp = require("cmp")
vim_item = lspkind.cmp_format({ local luasnip = require("luasnip")
mode = "symbol", local utils = require("utils")
maxwidth = 50, local lspkind = utils.try_require("lspkind")
ellipsis_char = "...",
before = function(_, item)
item.dup = 0 -- remove duplicates, see nvim-cmp #511
return item
end,
})(entry, vim_item)
end
return vim_item local opts = {
end, preselect = cmp.PreselectMode.None,
}, completion = {
mapping = { autocomplete = { "InsertEnter", "TextChanged" },
["<C-p>"] = cmp.mapping.select_prev_item({ keyword_length = 1,
behavior = cmp.SelectBehavior.Select,
}),
["<C-n>"] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Select,
}),
["<C-y>"] = function(fallback)
if cmp.visible() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace })
else
fallback()
end
end,
["<C-x><C-o>"] = cmp.mapping.complete(),
["<C-l>"] = function(fallback)
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
["<C-h>"] = function(fallback)
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
},
sources = {
{ name = "nvim_lsp" },
-- { name = "luasnip", },
{ name = "orgmode" },
{ name = "path" },
},
}
if utils.try_require("moonfly") then
local winhighlight = {
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
}
opt.window = {
completion = cmp.config.window.bordered(winhighlight),
documentation = cmp.config.window.bordered(winhighlight),
}
end
cmp.setup(opt)
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = { { name = "buffer" } },
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{
name = "cmdline",
option = { ignore_cmds = { "Man", "!" } },
}, },
}), snippet = {
}) expand = function(args)
end luasnip.lsp_expand(args.body)
end,
},
formatting = {
format = function(entry, vim_item)
if lspkind then
vim_item = lspkind.cmp_format({
mode = "symbol",
maxwidth = 50,
ellipsis_char = "...",
before = function(_, item)
item.dup = 0 -- remove duplicates, see nvim-cmp #511
return item
end,
})(entry, vim_item)
end
return setup return vim_item
end,
},
mapping = {
["<S-tab>"] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Insert,
}),
["<tab>"] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Insert,
}),
["<C-x><C-o>"] = cmp.mapping.complete(),
["<C-l>"] = function(fallback)
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
["<C-h>"] = function(fallback)
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
},
sources = {
{ name = "nvim_lsp" },
-- { name = "luasnip", },
{ name = "orgmode" },
{ name = "path" },
},
}
if utils.try_require("moonfly") then
local winhighlight = {
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
}
opts.window = {
completion = cmp.config.window.bordered(winhighlight),
documentation = cmp.config.window.bordered(winhighlight),
}
end
cmp.setup(opts)
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = { { name = "buffer" } },
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{
name = "cmdline",
option = { ignore_cmds = { "Man", "!" } },
},
}),
})
end,
}
+10 -10
View File
@@ -1,12 +1,12 @@
-- https://github.com/numToStr/Comment.nvim -- https://github.com/numToStr/Comment.nvim
local function setup() ---@type LazyPluginSpec
require("Comment").setup( return {
{ "numToStr/Comment.nvim",
--ignore empty lines lazy = true,
ignore = "^$", event = "VimEnter",
} opts = {
) --ignore empty lines
end ignore = "^$",
},
return setup }
+74 -69
View File
@@ -1,75 +1,80 @@
-- https://github.com/sindrets/diffview.nvim -- https://github.com/sindrets/diffview.nvim
local function setup() ---@type LazyPluginSpec
local actions = require("diffview.actions") return {
"sindrets/diffview.nvim",
require("diffview").setup({ dependencies = {
enhanced_diff_hl = true, "nvim-tree/nvim-web-devicons",
view = { },
default = { keys = {
layout = "diff2_horizontal", { "<leader>gg", vim.cmd.DiffviewOpen, mode = "n", remap = true },
winbar_info = true, },
}, config = function()
merge_tool = { local actions = require("diffview.actions")
layout = "diff3_mixed", require("diffview").setup({
disable_diagnostics = true, enhanced_diff_hl = true,
winbar_info = true, view = {
}, default = {
file_history = { layout = "diff2_horizontal",
layout = "diff2_horizontal", winbar_info = true,
winbar_info = true,
},
},
default_args = {
DiffviewOpen = { "--imply-local", },
},
keymaps = {
file_panel = {
["<cr>"] = false,
{
"n",
"<CR>",
function ()
actions.select_entry()
vim.cmd.wincmd("l")
end,
{ desc = "Open the current file in diffview", },
}, },
{ merge_tool = {
"n", layout = "diff3_mixed",
"s", disable_diagnostics = true,
actions.toggle_stage_entry, winbar_info = true,
{ desc = "Stage / unstage the selected entry", },
}, },
{ file_history = {
"n", layout = "diff2_horizontal",
"u", winbar_info = true,
actions.toggle_stage_entry,
{ desc = "Stage / unstage the selected entry", },
},
{
"n",
"cc",
function ()
vim.cmd.G("commit")
vim.cmd.wincmd("J")
end,
{ desc = "Commit staged changes", },
},
{
"n",
"ca",
function ()
vim.cmd.G("commit --amend")
vim.cmd.wincmd("J")
end,
{ desc = "Amend the last commit", },
}, },
}, },
}, default_args = {
}) DiffviewOpen = { "--imply-local" },
},
vim.keymap.set("n", "<leader>gg", vim.cmd.DiffviewOpen) keymaps = {
end file_panel = {
["<cr>"] = false,
return setup {
"n",
"<CR>",
function()
actions.select_entry()
vim.cmd.wincmd("l")
end,
{ desc = "Open the current file in diffview" },
},
{
"n",
"s",
actions.toggle_stage_entry,
{ desc = "Stage / unstage the selected entry" },
},
{
"n",
"u",
actions.toggle_stage_entry,
{ desc = "Stage / unstage the selected entry" },
},
{
"n",
"cc",
function()
vim.cmd.G("commit")
vim.cmd.wincmd("J")
end,
{ desc = "Commit staged changes" },
},
{
"n",
"ca",
function()
vim.cmd.G("commit --amend")
vim.cmd.wincmd("J")
end,
{ desc = "Amend the last commit" },
},
},
},
})
end,
}
+7 -5
View File
@@ -1,7 +1,9 @@
-- https://github.com/j-hui/fidget.nvim -- https://github.com/j-hui/fidget.nvim
local function setup() ---@type LazyPluginSpec
require("fidget").setup() return {
end "j-hui/fidget.nvim",
tag = "legacy",
return setup event = "LspAttach",
config = true,
}
+8 -5
View File
@@ -1,7 +1,10 @@
-- https://github.com/rbong/vim-flog -- https://github.com/rbong/vim-flog
local function setup() ---@type LazyPluginSpec
vim.keymap.set("n", "<leader>gl", vim.cmd.Flog) return {
end "rbong/vim-flog",
---@type LazyKeysSpec[]
return setup keys = {
{ "<leader>gl", vim.cmd.Flog, mode = "n" },
},
}
+16 -21
View File
@@ -1,9 +1,19 @@
-- https://github.com/is0n/fm-nvim -- https://github.com/is0n/fm-nvim
local function setup() ---@type LazyPluginSpec
local fm = require("fm-nvim") return {
"is0n/fm-nvim",
fm.setup({ keys = {
{
"<leader>fe",
function()
local file = vim.fn.expand("%:p")
if file ~= "" then vim.cmd.Lf(file) else vim.cmd.Lf() end
end,
mode = "n",
},
},
opts = {
-- UI Options -- UI Options
ui = { ui = {
float = { float = {
@@ -16,20 +26,5 @@ local function setup()
cmds = { cmds = {
nnn_cmd = "n", nnn_cmd = "n",
}, },
}) },
}
vim.keymap.set(
"n",
"<leader>fe",
function()
local file = vim.fn.expand("%:p")
if file ~= "" then
vim.cmd.Lf(file)
else
vim.cmd.Lf()
end
end
)
end
return setup
+19 -18
View File
@@ -1,22 +1,23 @@
-- https://github.com/tpope/vim-fugitive -- https://github.com/tpope/vim-fugitive
local function setup() local function git_status_tab()
local function git_status_tab() vim.cmd.tabnew()
vim.cmd.tabnew() vim.cmd("leftabove vertical G")
vim.cmd("leftabove vertical G") vim.cmd("vertical resize 60")
vim.cmd("vertical resize 60") vim.cmd.set("wfw")
vim.cmd.set("wfw")
end
vim.keymap.set("n", "<leader>gd", vim.cmd.Gdiffsplit)
vim.keymap.set("n", "<leader>gc", function () vim.cmd.G("commit") end)
vim.keymap.set("n", "<leader>ga", function () vim.cmd.G("commit --amend") end)
vim.keymap.set("n", "<leader>gp", function () vim.cmd.G("push") end)
-- Only used if diffview is not available
if not pcall(require, "diffview") then
vim.keymap.set("n", "<leader>gg", git_status_tab)
end
end end
return setup ---@type LazyPluginSpec
return {
"tpope/vim-fugitive",
lazy = true,
event = "VimEnter",
---@type LazyKeysSpec[]
keys = {
{ "<leader>gd", vim.cmd.Gdiffsplit, mode = "n" },
{ "<leader>gc", function() vim.cmd.G("commit") end, mode = "n" },
{ "<leader>ga", function() vim.cmd.G("commit --amend") end, mode = "n" },
{ "<leader>gp", function() vim.cmd.G("push") end, mode = "n" },
{ "<leader>gg", git_status_tab, mode = "n", remap = false },
},
}
+47 -41
View File
@@ -1,54 +1,60 @@
-- https://github.com/lewis6991/gitsigns.nvim -- https://github.com/lewis6991/gitsigns.nvim
local function setup() ---@type LazyPluginSpec
require("gitsigns").setup({ return {
on_attach = function (bufnr) "lewis6991/gitsigns.nvim",
lazy = true,
event = "VimEnter",
opts = {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns local gs = package.loaded.gitsigns
vim.keymap.set("n", "<leader>gv", gs.select_hunk, { buffer = bufnr, }) vim.keymap.set("n", "<leader>gv", gs.select_hunk, { buffer = bufnr })
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr, }) vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr })
vim.keymap.set("x", "<leader>gs", function ()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v"), })
end,
{ buffer = bufnr, })
vim.keymap.set({ "n", "x", }, "<leader>gu", gs.undo_stage_hunk,
{ buffer = bufnr, })
vim.keymap.set("n", "<leader>gr", gs.reset_hunk, { buffer = bufnr, })
vim.keymap.set( vim.keymap.set(
"x", "x",
"<leader>gr", "<leader>gs",
":Gitsigns reset_hunk<CR>", function()
{ buffer = bufnr, } gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end,
{ buffer = bufnr }
) )
vim.keymap.set("n", "<leader>g?", gs.preview_hunk, vim.keymap.set({ "n", "x" }, "<leader>gu", gs.undo_stage_hunk, { buffer = bufnr })
{ buffer = bufnr, }) vim.keymap.set("n", "<leader>gr", gs.reset_hunk, { buffer = bufnr })
vim.keymap.set("x", "<leader>gr", ":Gitsigns reset_hunk<CR>", { buffer = bufnr })
vim.keymap.set("n", "<leader>g?", gs.preview_hunk, { buffer = bufnr })
vim.keymap.set( vim.keymap.set(
"n", "n",
"<leader>gb", "<leader>gb",
function () function()
gs.blame_line { full = true, ignore_whitespace = true, } gs.blame_line { full = true, ignore_whitespace = true }
end, end,
{ buffer = bufnr, }) { buffer = bufnr }
vim.keymap.set({ "n", "x", }, "]g", function () )
gs.next_hunk({ vim.keymap.set(
wrap = true, { "n", "x" },
navigation_message = true, "]g", function()
foldopen = true, gs.next_hunk({
preview = true, wrap = true,
}) navigation_message = true,
end) foldopen = true,
vim.keymap.set({ "n", "x", }, "[g", function () preview = true,
gs.prev_hunk({ })
wrap = true, end
navigation_message = true, )
foldopen = true, vim.keymap.set(
preview = true, { "n", "x" },
}) "[g", function()
end) gs.prev_hunk({
wrap = true,
navigation_message = true,
foldopen = true,
preview = true,
})
end
)
end, end,
signs = { signs = {
untracked = { text = "", }, untracked = { text = "" },
}, },
}) },
end }
return setup
+35 -32
View File
@@ -1,37 +1,40 @@
-- https://github.com/cbochs/grapple.nvim -- https://github.com/cbochs/grapple.nvim
local function setup() ---@type LazyPluginSpec
local grapple = require("grapple") return {
grapple.setup() "cbochs/grapple.nvim",
vim.keymap.set("n", "<leader>'", grapple.toggle_tags) dependencies = { "nvim-lua/plenary.nvim" },
vim.keymap.set("n", "<leader>mm", function () config = function()
if grapple.exists() then local grapple = require("grapple")
grapple.untag() grapple.setup()
return vim.keymap.set("n", "<leader>'", grapple.toggle_tags)
end vim.keymap.set("n", "<leader>mm", function()
if grapple.exists() then
for i = 1, 9 do grapple.untag()
local opts = { name = "m" .. i, }
if not grapple.exists(opts) then
grapple.tag(opts)
return return
end end
for i = 1, 9 do
local opts = { name = "m" .. i }
if not grapple.exists(opts) then
grapple.tag(opts)
return
end
end
grapple.tag({ name = "m0" })
end)
for i = 1, 9 do
local opts = { name = "m" .. i }
vim.keymap.set("n", "<leader>m" .. i, function()
grapple.tag(opts)
end)
vim.keymap.set("n", "<leader>" .. i, function()
grapple.select(opts)
end)
end end
end,
grapple.tag({ name = "m?", }) }
end)
for i = 1, 9 do
local opts = { name = "m" .. i, }
vim.keymap.set("n", "<leader>m" .. i, function ()
grapple.tag(opts)
end)
vim.keymap.set("n", "<leader>" .. i, function ()
grapple.select(opts)
end)
end
end
return setup
+6 -5
View File
@@ -1,7 +1,8 @@
-- https://github.com/lvimuser/lsp-inlayhints.nvim -- https://github.com/lvimuser/lsp-inlayhints.nvim
local function setup() ---@type LazyPluginSpec
require("lsp-inlayhints").setup() return {
end "lvimuser/lsp-inlayhints.nvim",
branch = "anticonceal",
return setup config = true,
}
+10 -10
View File
@@ -1,12 +1,12 @@
-- https://github.com/onsails/lspkind.nvim -- https://github.com/onsails/lspkind.nvim
local function setup() ---@type LazyPluginSpec
local ok, _ = pcall(require, "nvim-cmp") return {
if ok then "onsails/lspkind.nvim",
-- configured and loaded in plugins.config.cmp config = function()
else local ok, _ = pcall(require, "nvim-cmp")
require("lspkind").init() if not ok then
end require("lspkind").init()
end end
end,
return setup }
+40 -36
View File
@@ -1,41 +1,45 @@
-- https://github.com/nvim-lualine/lualine.nvim -- https://github.com/nvim-lualine/lualine.nvim
local function setup() ---@type LazyPluginSpec
local custom_moonfly = require("lualine.themes.moonfly") return {
custom_moonfly.normal.c.bg = require("moonfly").palette.bg "nvim-lualine/lualine.nvim",
lazy = true,
event = "VimEnter",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
local custom_moonfly = require("lualine.themes.moonfly")
custom_moonfly.normal.c.bg = require("moonfly").palette.bg
require("lualine").setup({ require("lualine").setup({
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = custom_moonfly, theme = custom_moonfly,
component_separators = { left = "", right = "", }, component_separators = { left = "", right = "" },
section_separators = { left = "", right = "", }, section_separators = { left = "", right = "" },
always_divide_middle = true, always_divide_middle = true,
globalstatus = true, globalstatus = true,
}, },
sections = { sections = {
lualine_a = {}, lualine_a = {},
lualine_b = {}, lualine_b = {},
lualine_c = { lualine_c = {
{ "filename", path = 1, }, { "filename", path = 1 },
"diff", { "diff" },
{ "diagnostics", sources = { "nvim_lsp", }, }, { "diagnostics", sources = { "nvim_lsp" } },
{ { require("grapple").statusline, cond = require("grapple").exists },
require("grapple").statusline,
cond = require("grapple").exists,
}, },
lualine_x = {
"bo:filetype",
"encoding",
"bo:fileformat",
"progress",
"location",
},
lualine_y = {},
lualine_z = {},
}, },
lualine_x = { })
"bo:filetype", end,
"encoding", }
"bo:fileformat",
"progress",
"location",
},
lualine_y = {},
lualine_z = {},
},
})
end
return setup
-7
View File
@@ -1,7 +0,0 @@
-- https://github.com/L3MON4D3/LuaSnip
local function setup()
require("luasnip.loaders.from_vscode").lazy_load()
end
return setup
+7 -5
View File
@@ -1,7 +1,9 @@
-- https://github.com/williamboman/mason.nvim -- https://github.com/williamboman/mason.nvim
local function setup() ---@type LazyPluginSpec
require("mason").setup() return {
end "williamboman/mason.nvim",
lazy = true,
return setup event = "VimEnter",
config = true,
}
+15 -9
View File
@@ -1,11 +1,17 @@
-- https://github.com/bluz71/vim-moonfly-colors -- https://github.com/bluz71/vim-moonfly-colors
local function setup() ---@type LazyPluginSpec
vim.g.moonflyNormalFloat = true return {
vim.g.moonflyCursorColor = true "bluz71/vim-moonfly-colors",
vim.g.moonflyWinSeparator = 2 priority = 1000,
lazy = false,
vim.cmd.colorscheme("moonfly") name = "moonfly",
end init = function()
vim.g.moonflyNormalFloat = true
return setup vim.g.moonflyCursorColor = true
vim.g.moonflyWinSeparator = 2
end,
config = function()
vim.cmd.colorscheme("moonfly")
end,
}
+17 -16
View File
@@ -1,21 +1,22 @@
-- https://github.com/fedepujol/move.nvim -- https://github.com/fedepujol/move.nvim
local function setup() -- TODO: figure out how to add "silent" to keymaps
require("move").setup({ ---@type LazyPluginSpec
return {
"fedepujol/move.nvim",
keys = {
{ "<A-j>", function() vim.cmd.MoveLine(1) end, mode = "n" },
{ "<A-k>", function() vim.cmd.MoveLine(-1) end, mode = "n" },
{ "<A-h>", function() vim.cmd.MoveHChar(-1) end, mode = "n" },
{ "<A-l>", function() vim.cmd.MoveHChar(1) end, mode = "n" },
{ "<A-j>", ":MoveBlock(1)<CR>", mode = "x" },
{ "<A-k>", ":MoveBlock(-1)<CR>", mode = "x" },
{ "<A-h>", ":MoveHBlock(-1)<CR>", mode = "x" },
{ "<A-l>", ":MoveHBlock(1)<CR>", mode = "x" },
},
opts = {
char = { char = {
enable = true, enable = true,
}, },
}) },
}
local opts = { noremap = true, silent = true, }
vim.keymap.set("n", "<A-j>", function () vim.cmd.MoveLine(1) end, opts)
vim.keymap.set("n", "<A-k>", function () vim.cmd.MoveLine(-1) end, opts)
vim.keymap.set("n", "<A-h>", function () vim.cmd.MoveHChar(-1) end, opts)
vim.keymap.set("n", "<A-l>", function () vim.cmd.MoveHChar(1) end, opts)
vim.keymap.set("x", "<A-j>", ":MoveBlock(1)<CR>", opts)
vim.keymap.set("x", "<A-k>", ":MoveBlock(-1)<CR>", opts)
vim.keymap.set("x", "<A-h>", ":MoveHBlock(-1)<CR>", opts)
vim.keymap.set("x", "<A-l>", ":MoveHBlock(1)<CR>", opts)
end
return setup
+12 -16
View File
@@ -1,20 +1,16 @@
-- https://github.com/rcarriga/nvim-notify -- https://github.com/rcarriga/nvim-notify
local function setup() ---@type LazyPluginSpec
local has_telescope, telescope = pcall(require, "telescope") return {
"rcarriga/nvim-notify",
local notify = require("notify") priority = 900,
notify.setup({ lazy = false,
opts = {
render = "default", render = "default",
stages = "static", stages = "static",
}) },
config = function(_, opts)
vim.notify = notify vim.notify = require("notify")
vim.notify.setup(opts)
if has_telescope then end,
telescope.load_extension("notify") }
vim.keymap.set("n", "<leader>fn", telescope.extensions.notify.notify)
end
end
return setup
+9 -7
View File
@@ -1,14 +1,16 @@
local function setup() -- https://github.com/NvChad/nvim-colorizer.lua
require("colorizer").setup({
---@type LazyPluginSpec
return {
"NvChad/nvim-colorizer.lua",
opts = {
user_default_options = { user_default_options = {
RRGGBBAA = true, RRGGBBAA = true,
AARRGGBB = true, AARRGGBB = true,
css = true, css = true,
mode = "virtualtext", mode = "virtualtext",
tailwind = true, tailwind = true,
sass = { enable = true, }, sass = { enable = true },
}, },
}) },
end }
return setup
+10 -8
View File
@@ -1,9 +1,13 @@
-- https://github.com/nvim-orgmode/orgmode -- https://github.com/nvim-orgmode/orgmode
local function setup() ---@type LazyPluginSpec
local orgmode = require("orgmode") return {
orgmode.setup({ "nvim-orgmode/orgmode",
org_agenda_files = { "~/Documents/org/**/*", }, dependencies = {
"nvim-treesitter/nvim-treesitter",
},
opts = {
org_agenda_files = { "~/Documents/org/**/*" },
org_default_notes_file = "~/Documents/org/notes.org", org_default_notes_file = "~/Documents/org/notes.org",
org_todo_keywords = { org_todo_keywords = {
"TODO(t)", "TODO(t)",
@@ -28,7 +32,5 @@ local function setup()
org_agenda_skip_scheduled_if_done = true, org_agenda_skip_scheduled_if_done = true,
org_agenda_skip_deadline_if_done = true, org_agenda_skip_deadline_if_done = true,
}) },
end }
return setup
+107 -90
View File
@@ -1,100 +1,117 @@
-- https://github.com/nvim-telescope/telescope.nvim -- https://github.com/nvim-telescope/telescope.nvim
local function setup() ---@type LazyPluginSpec
local telescope = require("telescope") return {
local builtin = require("telescope.builtin") "nvim-telescope/telescope.nvim",
local actions = require("telescope.actions") lazy = true,
event = "VimEnter",
telescope.setup({ dependencies = {
defaults = { "nvim-lua/plenary.nvim",
mappings = { {
n = { "nvim-telescope/telescope-fzf-native.nvim",
q = actions.close, build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release"
["<C-c>"] = actions.close, .. " && cmake --build build --config Release"
l = actions.select_default, .. " && cmake --install build --prefix build",
},
},
}, },
pickers = { },
oldfiles = { config = function()
initial_mode = "normal", local telescope = require("telescope")
}, local builtin = require("telescope.builtin")
buffers = { local actions = require("telescope.actions")
initial_mode = "normal",
telescope.setup({
defaults = {
mappings = { mappings = {
i = { n = {
["<C-d>"] = actions.delete_buffer + actions.move_to_top, q = actions.close,
["<C-c>"] = actions.close,
l = actions.select_default,
}, },
}, },
}, },
diagnostics = { pickers = {
initial_mode = "normal", oldfiles = {
initial_mode = "normal",
},
buffers = {
initial_mode = "normal",
mappings = {
i = {
["<C-d>"] = actions.delete_buffer + actions.move_to_top,
},
},
},
diagnostics = {
initial_mode = "normal",
},
lsp_definitions = {
initial_mode = "normal",
},
lsp_type_definitions = {
initial_mode = "normal",
},
lsp_implementations = {
initial_mode = "normal",
},
lsp_references = {
initial_mode = "normal",
},
git_status = {
initial_mode = "normal",
},
}, },
lsp_definitions = { })
initial_mode = "normal",
},
lsp_type_definitions = {
initial_mode = "normal",
},
lsp_implementations = {
initial_mode = "normal",
},
lsp_references = {
initial_mode = "normal",
},
git_status = {
initial_mode = "normal",
},
},
})
vim.keymap.set( vim.keymap.set(
"n", "n",
"<leader>ff", "<leader>ff",
function () function()
builtin.find_files({ builtin.find_files({
hidden = true, hidden = true,
no_ignore = true, no_ignore = true,
no_ignore_parent = true, no_ignore_parent = true,
previewer = false, previewer = false,
}) })
end end
) )
vim.keymap.set( vim.keymap.set(
"n", "n",
"<leader>fr", "<leader>fr",
function () function()
builtin.oldfiles({ builtin.oldfiles({
only_cwd = true, only_cwd = true,
hidden = true, hidden = true,
previewer = false, previewer = false,
}) })
end end
) )
vim.keymap.set( vim.keymap.set(
"n", "<leader>fg", function () "n",
builtin.live_grep({ "<leader>fg",
additional_args = function (_) function()
return { builtin.live_grep({
"--hidden", additional_args = function(_)
"--iglob=!.venv", return {
"--iglob=!vendor", "--hidden",
"--iglob=!.git", "--iglob=!.venv",
} "--iglob=!vendor",
end, "--iglob=!.git",
previewer = false, }
}) end,
end previewer = false,
) })
vim.keymap.set( end
"n", )
"<leader>fb", vim.keymap.set(
function () "n",
builtin.buffers({ previewer = false, sort_mru = true, }) "<leader>fb",
end function()
) builtin.buffers({ previewer = false, sort_mru = true })
end
)
telescope.load_extension("fzf") telescope.load_extension("fzf")
end telescope.load_extension("notify")
vim.keymap.set("n", "<leader>fn", telescope.extensions.notify.notify)
return setup end,
}
-18
View File
@@ -1,18 +0,0 @@
-- https://github.com/folke/tokyonight.nvim
local function setup()
local tokyonight = require("tokyonight")
tokyonight.setup({
style = "night",
styles = {
comments = { italic = false, },
keywords = { italic = false, },
},
lualine_bold = false,
})
tokyonight.load()
end
return setup
-10
View File
@@ -1,10 +0,0 @@
-- https://github.com/nvim-treesitter/nvim-treesitter-context
local function setup()
require("treesitter-context").setup({
max_lines = 1,
min_window_height = 10,
})
end
return setup
+51 -41
View File
@@ -1,47 +1,57 @@
-- https://github.com/nvim-treesitter/nvim-treesitter -- https://github.com/nvim-treesitter/nvim-treesitter
local function setup() ---@type LazyPluginSpec[]
require("nvim-treesitter.configs").setup({ return {
ensure_installed = { {
"c", -- recommended default "nvim-treesitter/nvim-treesitter",
"lua", -- recommended default build = ":TSUpdate",
"vim", -- recommended default lazy = true,
"vimdoc", -- recommended default event = "VimEnter",
"query", -- recommended default opts = {
"luadoc", ensure_installed = {
"phpdoc", "c", -- recommended default
"regex", -- for noice "lua", -- recommended default
"bash", -- for noice "vim", -- recommended default
"markdown", -- for noice "vimdoc", -- recommended default
"markdown_inline", -- for noice "query", -- recommended default
"org", "luadoc",
"comment", "phpdoc",
"org",
"comment",
},
auto_install = true,
highlight = {
enable = true,
disable = {},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "org", "php" },
},
}, },
auto_install = true, config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
highlight = { vim.opt.foldmethod = "expr"
enable = true, vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
disable = {}, vim.opt.foldenable = true
-- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- Disable LSP semantic highlighting for comments because it will otherwise
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). -- override highlights from `comment`.
-- Using this option may slow down your editor, and you may see some duplicate highlights. vim.api.nvim_set_hl(0, "@lsp.type.comment", {})
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "org", "php" }, -- To set the priority of semantic highlighting lower than treesitter (100),
-- uncomment the line below:
-- vim.highlight.priorities.semantic_tokens = 99
end,
},
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
max_lines = 1,
min_window_height = 10,
}, },
}) },
}
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldenable = true
-- Disable LSP semantic highlighting for comments because it will otherwise
-- override highlights from `comment`.
vim.api.nvim_set_hl(0, '@lsp.type.comment', {})
-- To set the priority of semantic highlighting lower than treesitter (100),
-- uncomment the line below:
-- vim.highlight.priorities.semantic_tokens = 99
end
return setup
-16
View File
@@ -1,16 +0,0 @@
-- https://github.com/Mofiqul/vscode.nvim
local function setup()
local vscode = require("vscode")
vscode.setup({
style = "dark",
transparent = false,
italic_comments = false,
disable_nvimtree_bg = false,
})
vscode.load()
end
return setup
+13 -9
View File
@@ -1,11 +1,15 @@
-- https://github.com/simeji/winresizer -- https://github.com/simeji/winresizer
local function setup() ---@type LazyPluginSpec
vim.g.winresizer_vert_resize = "5" return {
vim.g.winresizer_horiz_resize = "5" "simeji/winresizer",
vim.g.winresizer_start_key = "" lazy = true,
keys = {
vim.keymap.set("n", "<C-W>r", vim.cmd.WinResizerStartResize) { "<C-W>r", vim.cmd.WinResizerStartResize, mode = "n" },
end },
init = function()
return setup vim.g.winresizer_vert_resize = "5"
vim.g.winresizer_horiz_resize = "5"
vim.g.winresizer_start_key = ""
end,
}
+8 -9
View File
@@ -1,11 +1,10 @@
-- https://github.com/sindrets/winshift.nvim -- https://github.com/sindrets/winshift.nvim
local function setup() ---@type LazyPluginSpec
vim.keymap.set( return {
"n", "sindrets/winshift.nvim",
"<C-W>m", lazy = true,
vim.cmd.WinShift keys = {
) { "<C-W>m", vim.cmd.WinShift, mode = "n" },
end },
}
return setup