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")
@@ -15,8 +15,8 @@ for _, file in ipairs(files) do
local pkg = "core." .. file
local ok, err = pcall(require, pkg)
if not ok then
utils.err("Error while loading package " .. pkg, module_name)
utils.err(err, module_name)
utils.err("Error while loading package " .. pkg)
utils.err(err)
return
end
end
@@ -26,15 +26,26 @@ if vim.g.vscode then
else
local ok, err = pcall(require, "bootstrap")
if not ok then
utils.err("Error during bootstrap", module_name)
utils.err(err:gsub("\t", " "), module_name)
utils.err("Error during bootstrap")
utils.err(err:gsub("\t", " "))
return
end
ok, err = pcall(require, "plugins")
if not ok then
utils.err("Error while loading plugins", module_name)
utils.err(err:gsub("\t", " "), module_name)
return
end
---@type LazyPluginSpec[]
local plugins = {
{
"neovim/nvim-lspconfig",
config = require("lsp").setup,
},
{ import = "plugins" },
}
---@type LazyConfig
local opts = {
install = {
colorscheme = { "moonfly" },
},
}
require("lazy").setup(plugins, opts)
end
+8 -1
View File
@@ -1,6 +1,13 @@
vim.api.nvim_create_autocmd("FileType", {
desc = "Use tabs for indents in Go files",
pattern = "go",
callback = function ()
callback = function()
vim.bo.expandtab = false
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" })
vim.lsp.handlers["textDocument/signatureHelp"] =
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
--- Configure the LSP client
@@ -203,6 +208,22 @@ function M:configure_client()
capabilities = vim.tbl_deep_extend("force", capabilities,
cmp_nvim_lsp.default_capabilities())
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.on_attach = function(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
local function setup()
vim.keymap.set(
"n",
"<C-w>q",
vim.cmd.Bwipeout,
{ remap = false, silent = true, }
)
end
return setup
---@type LazyPluginSpec
return {
"famiu/bufdelete.nvim",
keys = {
{ "<C-w>q", vim.cmd.Bwipeout, { remap = false, silent = true }, mode = "n" },
},
}
+33 -22
View File
@@ -24,15 +24,35 @@ local function has_words_after()
~= nil
end
local function setup()
local utils = require("utils")
---@type LazyPluginSpec
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 luasnip = require("luasnip")
local utils = require("utils")
local lspkind = utils.try_require("lspkind")
local opt = {
local opts = {
preselect = cmp.PreselectMode.None,
completion = { keyword_length = 0 },
completion = {
autocomplete = { "InsertEnter", "TextChanged" },
keyword_length = 1,
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
@@ -55,20 +75,14 @@ local function setup()
return vim_item
end,
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Select,
["<S-tab>"] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Insert,
}),
["<C-n>"] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Select,
["<tab>"] = cmp.mapping.select_next_item({
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-l>"] = function(fallback)
if luasnip.expand_or_locally_jumpable() then
@@ -97,19 +111,17 @@ local function setup()
local winhighlight = {
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
}
opt.window = {
opts.window = {
completion = cmp.config.window.bordered(winhighlight),
documentation = cmp.config.window.bordered(winhighlight),
}
end
cmp.setup(opt)
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" } }, {
@@ -119,6 +131,5 @@ local function setup()
},
}),
})
end
return setup
end,
}
+8 -8
View File
@@ -1,12 +1,12 @@
-- https://github.com/numToStr/Comment.nvim
local function setup()
require("Comment").setup(
{
---@type LazyPluginSpec
return {
"numToStr/Comment.nvim",
lazy = true,
event = "VimEnter",
opts = {
--ignore empty lines
ignore = "^$",
}
)
end
return setup
},
}
+21 -16
View File
@@ -1,8 +1,16 @@
-- 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")
require("diffview").setup({
enhanced_diff_hl = true,
view = {
@@ -21,7 +29,7 @@ local function setup()
},
},
default_args = {
DiffviewOpen = { "--imply-local", },
DiffviewOpen = { "--imply-local" },
},
keymaps = {
file_panel = {
@@ -29,47 +37,44 @@ local function setup()
{
"n",
"<CR>",
function ()
function()
actions.select_entry()
vim.cmd.wincmd("l")
end,
{ desc = "Open the current file in diffview", },
{ desc = "Open the current file in diffview" },
},
{
"n",
"s",
actions.toggle_stage_entry,
{ desc = "Stage / unstage the selected entry", },
{ desc = "Stage / unstage the selected entry" },
},
{
"n",
"u",
actions.toggle_stage_entry,
{ desc = "Stage / unstage the selected entry", },
{ desc = "Stage / unstage the selected entry" },
},
{
"n",
"cc",
function ()
function()
vim.cmd.G("commit")
vim.cmd.wincmd("J")
end,
{ desc = "Commit staged changes", },
{ desc = "Commit staged changes" },
},
{
"n",
"ca",
function ()
function()
vim.cmd.G("commit --amend")
vim.cmd.wincmd("J")
end,
{ desc = "Amend the last commit", },
{ desc = "Amend the last commit" },
},
},
},
})
vim.keymap.set("n", "<leader>gg", vim.cmd.DiffviewOpen)
end
return setup
end,
}
+7 -5
View File
@@ -1,7 +1,9 @@
-- https://github.com/j-hui/fidget.nvim
local function setup()
require("fidget").setup()
end
return setup
---@type LazyPluginSpec
return {
"j-hui/fidget.nvim",
tag = "legacy",
event = "LspAttach",
config = true,
}
+8 -5
View File
@@ -1,7 +1,10 @@
-- https://github.com/rbong/vim-flog
local function setup()
vim.keymap.set("n", "<leader>gl", vim.cmd.Flog)
end
return setup
---@type LazyPluginSpec
return {
"rbong/vim-flog",
---@type LazyKeysSpec[]
keys = {
{ "<leader>gl", vim.cmd.Flog, mode = "n" },
},
}
+16 -21
View File
@@ -1,9 +1,19 @@
-- https://github.com/is0n/fm-nvim
local function setup()
local fm = require("fm-nvim")
fm.setup({
---@type LazyPluginSpec
return {
"is0n/fm-nvim",
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 = {
float = {
@@ -16,20 +26,5 @@ local function setup()
cmds = {
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
local function setup()
local function git_status_tab()
local function git_status_tab()
vim.cmd.tabnew()
vim.cmd("leftabove vertical G")
vim.cmd("vertical resize 60")
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
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
local function setup()
require("gitsigns").setup({
on_attach = function (bufnr)
---@type LazyPluginSpec
return {
"lewis6991/gitsigns.nvim",
lazy = true,
event = "VimEnter",
opts = {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
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("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("n", "<leader>gv", gs.select_hunk, { buffer = bufnr })
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr })
vim.keymap.set(
"x",
"<leader>gr",
":Gitsigns reset_hunk<CR>",
{ buffer = bufnr, }
"<leader>gs",
function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end,
{ buffer = bufnr }
)
vim.keymap.set("n", "<leader>g?", gs.preview_hunk,
{ 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("x", "<leader>gr", ":Gitsigns reset_hunk<CR>", { buffer = bufnr })
vim.keymap.set("n", "<leader>g?", gs.preview_hunk, { buffer = bufnr })
vim.keymap.set(
"n",
"<leader>gb",
function ()
gs.blame_line { full = true, ignore_whitespace = true, }
function()
gs.blame_line { full = true, ignore_whitespace = true }
end,
{ buffer = bufnr, })
vim.keymap.set({ "n", "x", }, "]g", function ()
{ buffer = bufnr }
)
vim.keymap.set(
{ "n", "x" },
"]g", function()
gs.next_hunk({
wrap = true,
navigation_message = true,
foldopen = true,
preview = true,
})
end)
vim.keymap.set({ "n", "x", }, "[g", function ()
end
)
vim.keymap.set(
{ "n", "x" },
"[g", function()
gs.prev_hunk({
wrap = true,
navigation_message = true,
foldopen = true,
preview = true,
})
end)
end
)
end,
signs = {
untracked = { text = "", },
untracked = { text = "" },
},
})
end
return setup
},
}
+13 -10
View File
@@ -1,37 +1,40 @@
-- 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")
grapple.setup()
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
grapple.untag()
return
end
for i = 1, 9 do
local opts = { name = "m" .. i, }
local opts = { name = "m" .. i }
if not grapple.exists(opts) then
grapple.tag(opts)
return
end
end
grapple.tag({ name = "m?", })
grapple.tag({ name = "m0" })
end)
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)
end)
vim.keymap.set("n", "<leader>" .. i, function ()
vim.keymap.set("n", "<leader>" .. i, function()
grapple.select(opts)
end)
end
end
return setup
end,
}
+6 -5
View File
@@ -1,7 +1,8 @@
-- https://github.com/lvimuser/lsp-inlayhints.nvim
local function setup()
require("lsp-inlayhints").setup()
end
return setup
---@type LazyPluginSpec
return {
"lvimuser/lsp-inlayhints.nvim",
branch = "anticonceal",
config = true,
}
+7 -7
View File
@@ -1,12 +1,12 @@
-- https://github.com/onsails/lspkind.nvim
local function setup()
---@type LazyPluginSpec
return {
"onsails/lspkind.nvim",
config = function()
local ok, _ = pcall(require, "nvim-cmp")
if ok then
-- configured and loaded in plugins.config.cmp
else
if not ok then
require("lspkind").init()
end
end
return setup
end,
}
+17 -13
View File
@@ -1,6 +1,14 @@
-- 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")
custom_moonfly.normal.c.bg = require("moonfly").palette.bg
@@ -8,8 +16,8 @@ local function setup()
options = {
icons_enabled = true,
theme = custom_moonfly,
component_separators = { left = "", right = "", },
section_separators = { left = "", right = "", },
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
always_divide_middle = true,
globalstatus = true,
},
@@ -17,13 +25,10 @@ local function setup()
lualine_a = {},
lualine_b = {},
lualine_c = {
{ "filename", path = 1, },
"diff",
{ "diagnostics", sources = { "nvim_lsp", }, },
{
require("grapple").statusline,
cond = require("grapple").exists,
},
{ "filename", path = 1 },
{ "diff" },
{ "diagnostics", sources = { "nvim_lsp" } },
{ require("grapple").statusline, cond = require("grapple").exists },
},
lualine_x = {
"bo:filetype",
@@ -36,6 +41,5 @@ local function setup()
lualine_z = {},
},
})
end
return setup
end,
}
-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
local function setup()
require("mason").setup()
end
return setup
---@type LazyPluginSpec
return {
"williamboman/mason.nvim",
lazy = true,
event = "VimEnter",
config = true,
}
+11 -5
View File
@@ -1,11 +1,17 @@
-- 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.moonflyCursorColor = true
vim.g.moonflyWinSeparator = 2
end,
config = function()
vim.cmd.colorscheme("moonfly")
end
return setup
end,
}
+17 -16
View File
@@ -1,21 +1,22 @@
-- https://github.com/fedepujol/move.nvim
local function setup()
require("move").setup({
-- TODO: figure out how to add "silent" to keymaps
---@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 = {
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
local function setup()
local has_telescope, telescope = pcall(require, "telescope")
local notify = require("notify")
notify.setup({
---@type LazyPluginSpec
return {
"rcarriga/nvim-notify",
priority = 900,
lazy = false,
opts = {
render = "default",
stages = "static",
})
vim.notify = notify
if has_telescope then
telescope.load_extension("notify")
vim.keymap.set("n", "<leader>fn", telescope.extensions.notify.notify)
end
end
return setup
},
config = function(_, opts)
vim.notify = require("notify")
vim.notify.setup(opts)
end,
}
+9 -7
View File
@@ -1,14 +1,16 @@
local function setup()
require("colorizer").setup({
-- https://github.com/NvChad/nvim-colorizer.lua
---@type LazyPluginSpec
return {
"NvChad/nvim-colorizer.lua",
opts = {
user_default_options = {
RRGGBBAA = true,
AARRGGBB = true,
css = true,
mode = "virtualtext",
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
local function setup()
local orgmode = require("orgmode")
orgmode.setup({
org_agenda_files = { "~/Documents/org/**/*", },
---@type LazyPluginSpec
return {
"nvim-orgmode/orgmode",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
opts = {
org_agenda_files = { "~/Documents/org/**/*" },
org_default_notes_file = "~/Documents/org/notes.org",
org_todo_keywords = {
"TODO(t)",
@@ -28,7 +32,5 @@ local function setup()
org_agenda_skip_scheduled_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
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 builtin = require("telescope.builtin")
local actions = require("telescope.actions")
@@ -51,7 +65,7 @@ local function setup()
vim.keymap.set(
"n",
"<leader>ff",
function ()
function()
builtin.find_files({
hidden = true,
no_ignore = true,
@@ -63,7 +77,7 @@ local function setup()
vim.keymap.set(
"n",
"<leader>fr",
function ()
function()
builtin.oldfiles({
only_cwd = true,
hidden = true,
@@ -72,9 +86,11 @@ local function setup()
end
)
vim.keymap.set(
"n", "<leader>fg", function ()
"n",
"<leader>fg",
function()
builtin.live_grep({
additional_args = function (_)
additional_args = function(_)
return {
"--hidden",
"--iglob=!.venv",
@@ -89,12 +105,13 @@ local function setup()
vim.keymap.set(
"n",
"<leader>fb",
function ()
builtin.buffers({ previewer = false, sort_mru = true, })
function()
builtin.buffers({ previewer = false, sort_mru = true })
end
)
telescope.load_extension("fzf")
end
return setup
telescope.load_extension("notify")
vim.keymap.set("n", "<leader>fn", telescope.extensions.notify.notify)
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
local function setup()
require("nvim-treesitter.configs").setup({
---@type LazyPluginSpec[]
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
lazy = true,
event = "VimEnter",
opts = {
ensure_installed = {
"c", -- recommended default
"lua", -- recommended default
@@ -10,15 +16,10 @@ local function setup()
"query", -- recommended default
"luadoc",
"phpdoc",
"regex", -- for noice
"bash", -- for noice
"markdown", -- for noice
"markdown_inline", -- for noice
"org",
"comment",
},
auto_install = true,
highlight = {
enable = true,
disable = {},
@@ -29,7 +30,9 @@ local function setup()
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "org", "php" },
},
})
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
@@ -37,11 +40,18 @@ local function setup()
-- Disable LSP semantic highlighting for comments because it will otherwise
-- 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),
-- uncomment the line below:
-- vim.highlight.priorities.semantic_tokens = 99
end
return setup
end,
},
{
"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
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_horiz_resize = "5"
vim.g.winresizer_start_key = ""
vim.keymap.set("n", "<C-W>r", vim.cmd.WinResizerStartResize)
end
return setup
end,
}
+8 -9
View File
@@ -1,11 +1,10 @@
-- https://github.com/sindrets/winshift.nvim
local function setup()
vim.keymap.set(
"n",
"<C-W>m",
vim.cmd.WinShift
)
end
return setup
---@type LazyPluginSpec
return {
"sindrets/winshift.nvim",
lazy = true,
keys = {
{ "<C-W>m", vim.cmd.WinShift, mode = "n" },
},
}