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
+33 -22
View File
@@ -24,15 +24,35 @@ local function has_words_after()
~= nil ~= nil
end end
local function setup() ---@type LazyPluginSpec
local utils = require("utils") return {
"hrsh7th/nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp",
{
"L3MON4D3/LuaSnip",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
build = (require("utils").os_name ~= "Windows_NT" and "make install_jsregexp" or nil),
version = "2.*",
},
},
config = function()
local cmp = require("cmp") local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
local utils = require("utils")
local lspkind = utils.try_require("lspkind") local lspkind = utils.try_require("lspkind")
local opt = { local opts = {
preselect = cmp.PreselectMode.None, preselect = cmp.PreselectMode.None,
completion = { keyword_length = 0 }, completion = {
autocomplete = { "InsertEnter", "TextChanged" },
keyword_length = 1,
},
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
@@ -55,20 +75,14 @@ local function setup()
return vim_item return vim_item
end, end,
}, },
mapping = { mapping = {
["<C-p>"] = cmp.mapping.select_prev_item({ ["<S-tab>"] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Select, behavior = cmp.SelectBehavior.Insert,
}), }),
["<C-n>"] = cmp.mapping.select_next_item({ ["<tab>"] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Select, behavior = cmp.SelectBehavior.Insert,
}), }),
["<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-x><C-o>"] = cmp.mapping.complete(),
["<C-l>"] = function(fallback) ["<C-l>"] = function(fallback)
if luasnip.expand_or_locally_jumpable() then if luasnip.expand_or_locally_jumpable() then
@@ -97,19 +111,17 @@ local function setup()
local winhighlight = { local winhighlight = {
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel", winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
} }
opt.window = { opts.window = {
completion = cmp.config.window.bordered(winhighlight), completion = cmp.config.window.bordered(winhighlight),
documentation = cmp.config.window.bordered(winhighlight), documentation = cmp.config.window.bordered(winhighlight),
} }
end end
cmp.setup(opt) cmp.setup(opts)
cmp.setup.cmdline("/", { cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = { { name = "buffer" } }, sources = { { name = "buffer" } },
}) })
cmp.setup.cmdline(":", { cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, { sources = cmp.config.sources({ { name = "path" } }, {
@@ -119,6 +131,5 @@ local function setup()
}, },
}), }),
}) })
end end,
}
return setup
+8 -8
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",
lazy = true,
event = "VimEnter",
opts = {
--ignore empty lines --ignore empty lines
ignore = "^$", ignore = "^$",
} },
) }
end
return setup
+21 -16
View File
@@ -1,8 +1,16 @@
-- https://github.com/sindrets/diffview.nvim -- https://github.com/sindrets/diffview.nvim
local function setup() ---@type LazyPluginSpec
return {
"sindrets/diffview.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
keys = {
{ "<leader>gg", vim.cmd.DiffviewOpen, mode = "n", remap = true },
},
config = function()
local actions = require("diffview.actions") local actions = require("diffview.actions")
require("diffview").setup({ require("diffview").setup({
enhanced_diff_hl = true, enhanced_diff_hl = true,
view = { view = {
@@ -21,7 +29,7 @@ local function setup()
}, },
}, },
default_args = { default_args = {
DiffviewOpen = { "--imply-local", }, DiffviewOpen = { "--imply-local" },
}, },
keymaps = { keymaps = {
file_panel = { file_panel = {
@@ -29,47 +37,44 @@ local function setup()
{ {
"n", "n",
"<CR>", "<CR>",
function () function()
actions.select_entry() actions.select_entry()
vim.cmd.wincmd("l") vim.cmd.wincmd("l")
end, end,
{ desc = "Open the current file in diffview", }, { desc = "Open the current file in diffview" },
}, },
{ {
"n", "n",
"s", "s",
actions.toggle_stage_entry, actions.toggle_stage_entry,
{ desc = "Stage / unstage the selected entry", }, { desc = "Stage / unstage the selected entry" },
}, },
{ {
"n", "n",
"u", "u",
actions.toggle_stage_entry, actions.toggle_stage_entry,
{ desc = "Stage / unstage the selected entry", }, { desc = "Stage / unstage the selected entry" },
}, },
{ {
"n", "n",
"cc", "cc",
function () function()
vim.cmd.G("commit") vim.cmd.G("commit")
vim.cmd.wincmd("J") vim.cmd.wincmd("J")
end, end,
{ desc = "Commit staged changes", }, { desc = "Commit staged changes" },
}, },
{ {
"n", "n",
"ca", "ca",
function () function()
vim.cmd.G("commit --amend") vim.cmd.G("commit --amend")
vim.cmd.wincmd("J") vim.cmd.wincmd("J")
end, end,
{ desc = "Amend the last commit", }, { desc = "Amend the last commit" },
}, },
}, },
}, },
}) })
end,
vim.keymap.set("n", "<leader>gg", vim.cmd.DiffviewOpen) }
end
return setup
+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
+15 -14
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 },
},
}
+35 -29
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 () )
vim.keymap.set(
{ "n", "x" },
"]g", function()
gs.next_hunk({ gs.next_hunk({
wrap = true, wrap = true,
navigation_message = true, navigation_message = true,
foldopen = true, foldopen = true,
preview = true, preview = true,
}) })
end) end
vim.keymap.set({ "n", "x", }, "[g", function () )
vim.keymap.set(
{ "n", "x" },
"[g", function()
gs.prev_hunk({ gs.prev_hunk({
wrap = true, wrap = true,
navigation_message = true, navigation_message = true,
foldopen = true, foldopen = true,
preview = true, preview = true,
}) })
end) end
)
end, end,
signs = { signs = {
untracked = { text = "", }, untracked = { text = "" },
}, },
}) },
end }
return setup
+13 -10
View File
@@ -1,37 +1,40 @@
-- https://github.com/cbochs/grapple.nvim -- https://github.com/cbochs/grapple.nvim
local function setup() ---@type LazyPluginSpec
return {
"cbochs/grapple.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local grapple = require("grapple") local grapple = require("grapple")
grapple.setup() grapple.setup()
vim.keymap.set("n", "<leader>'", grapple.toggle_tags) vim.keymap.set("n", "<leader>'", grapple.toggle_tags)
vim.keymap.set("n", "<leader>mm", function () vim.keymap.set("n", "<leader>mm", function()
if grapple.exists() then if grapple.exists() then
grapple.untag() grapple.untag()
return return
end end
for i = 1, 9 do for i = 1, 9 do
local opts = { name = "m" .. i, } local opts = { name = "m" .. i }
if not grapple.exists(opts) then if not grapple.exists(opts) then
grapple.tag(opts) grapple.tag(opts)
return return
end end
end end
grapple.tag({ name = "m?", }) grapple.tag({ name = "m0" })
end) end)
for i = 1, 9 do for i = 1, 9 do
local opts = { name = "m" .. i, } local opts = { name = "m" .. i }
vim.keymap.set("n", "<leader>m" .. i, function () vim.keymap.set("n", "<leader>m" .. i, function()
grapple.tag(opts) grapple.tag(opts)
end) end)
vim.keymap.set("n", "<leader>" .. i, function () vim.keymap.set("n", "<leader>" .. i, function()
grapple.select(opts) grapple.select(opts)
end) end)
end 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,
}
+7 -7
View File
@@ -1,12 +1,12 @@
-- https://github.com/onsails/lspkind.nvim -- https://github.com/onsails/lspkind.nvim
local function setup() ---@type LazyPluginSpec
return {
"onsails/lspkind.nvim",
config = function()
local ok, _ = pcall(require, "nvim-cmp") local ok, _ = pcall(require, "nvim-cmp")
if ok then if not ok then
-- configured and loaded in plugins.config.cmp
else
require("lspkind").init() require("lspkind").init()
end end
end end,
}
return setup
+17 -13
View File
@@ -1,6 +1,14 @@
-- https://github.com/nvim-lualine/lualine.nvim -- https://github.com/nvim-lualine/lualine.nvim
local function setup() ---@type LazyPluginSpec
return {
"nvim-lualine/lualine.nvim",
lazy = true,
event = "VimEnter",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
local custom_moonfly = require("lualine.themes.moonfly") local custom_moonfly = require("lualine.themes.moonfly")
custom_moonfly.normal.c.bg = require("moonfly").palette.bg custom_moonfly.normal.c.bg = require("moonfly").palette.bg
@@ -8,8 +16,8 @@ local function 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,
}, },
@@ -17,13 +25,10 @@ local function setup()
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 = { lualine_x = {
"bo:filetype", "bo:filetype",
@@ -36,6 +41,5 @@ local function setup()
lualine_z = {}, lualine_z = {},
}, },
}) })
end 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,
}
+11 -5
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
return {
"bluz71/vim-moonfly-colors",
priority = 1000,
lazy = false,
name = "moonfly",
init = function()
vim.g.moonflyNormalFloat = true vim.g.moonflyNormalFloat = true
vim.g.moonflyCursorColor = true vim.g.moonflyCursorColor = true
vim.g.moonflyWinSeparator = 2 vim.g.moonflyWinSeparator = 2
end,
config = function()
vim.cmd.colorscheme("moonfly") vim.cmd.colorscheme("moonfly")
end end,
}
return setup
+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
+27 -10
View File
@@ -1,6 +1,20 @@
-- https://github.com/nvim-telescope/telescope.nvim -- https://github.com/nvim-telescope/telescope.nvim
local function setup() ---@type LazyPluginSpec
return {
"nvim-telescope/telescope.nvim",
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",
},
},
config = function()
local telescope = require("telescope") local telescope = require("telescope")
local builtin = require("telescope.builtin") local builtin = require("telescope.builtin")
local actions = require("telescope.actions") local actions = require("telescope.actions")
@@ -51,7 +65,7 @@ local function setup()
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,
@@ -63,7 +77,7 @@ local function setup()
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,
@@ -72,9 +86,11 @@ local function setup()
end end
) )
vim.keymap.set( vim.keymap.set(
"n", "<leader>fg", function () "n",
"<leader>fg",
function()
builtin.live_grep({ builtin.live_grep({
additional_args = function (_) additional_args = function(_)
return { return {
"--hidden", "--hidden",
"--iglob=!.venv", "--iglob=!.venv",
@@ -89,12 +105,13 @@ local function setup()
vim.keymap.set( vim.keymap.set(
"n", "n",
"<leader>fb", "<leader>fb",
function () function()
builtin.buffers({ previewer = false, sort_mru = true, }) builtin.buffers({ previewer = false, sort_mru = true })
end 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
+22 -12
View File
@@ -1,7 +1,13 @@
-- 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 {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
lazy = true,
event = "VimEnter",
opts = {
ensure_installed = { ensure_installed = {
"c", -- recommended default "c", -- recommended default
"lua", -- recommended default "lua", -- recommended default
@@ -10,15 +16,10 @@ local function setup()
"query", -- recommended default "query", -- recommended default
"luadoc", "luadoc",
"phpdoc", "phpdoc",
"regex", -- for noice
"bash", -- for noice
"markdown", -- for noice
"markdown_inline", -- for noice
"org", "org",
"comment", "comment",
}, },
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
disable = {}, disable = {},
@@ -29,7 +30,9 @@ local function setup()
-- Instead of true it can also be a list of languages -- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "org", "php" }, additional_vim_regex_highlighting = { "org", "php" },
}, },
}) },
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
vim.opt.foldmethod = "expr" vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()" vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
@@ -37,11 +40,18 @@ local function setup()
-- Disable LSP semantic highlighting for comments because it will otherwise -- Disable LSP semantic highlighting for comments because it will otherwise
-- override highlights from `comment`. -- override highlights from `comment`.
vim.api.nvim_set_hl(0, '@lsp.type.comment', {}) vim.api.nvim_set_hl(0, "@lsp.type.comment", {})
-- To set the priority of semantic highlighting lower than treesitter (100), -- To set the priority of semantic highlighting lower than treesitter (100),
-- uncomment the line below: -- uncomment the line below:
-- vim.highlight.priorities.semantic_tokens = 99 -- vim.highlight.priorities.semantic_tokens = 99
end end,
},
return setup {
"nvim-treesitter/nvim-treesitter-context",
opts = {
max_lines = 1,
min_window_height = 10,
},
},
}
-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
+10 -6
View File
@@ -1,11 +1,15 @@
-- https://github.com/simeji/winresizer -- https://github.com/simeji/winresizer
local function setup() ---@type LazyPluginSpec
return {
"simeji/winresizer",
lazy = true,
keys = {
{ "<C-W>r", vim.cmd.WinResizerStartResize, mode = "n" },
},
init = function()
vim.g.winresizer_vert_resize = "5" vim.g.winresizer_vert_resize = "5"
vim.g.winresizer_horiz_resize = "5" vim.g.winresizer_horiz_resize = "5"
vim.g.winresizer_start_key = "" vim.g.winresizer_start_key = ""
end,
vim.keymap.set("n", "<C-W>r", vim.cmd.WinResizerStartResize) }
end
return setup
+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