migrate to lazy.nvim
This commit is contained in:
parent
b5d7c3b5a3
commit
c0940a870c
55
init.lua
55
init.lua
|
|
@ -1,49 +1,24 @@
|
||||||
vim.defer_fn(function()
|
require "core.options"
|
||||||
pcall(require, "impatient")
|
require("core.utils").load_mappings()
|
||||||
end, 0)
|
-- require("colors").core_setup()
|
||||||
|
|
||||||
-- setup packer + plugins
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
local fn = vim.fn
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
"clone",
|
||||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
|
"--filter=blob:none",
|
||||||
print "Cloning packer .."
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
-- install plugins + compile their configs
|
})
|
||||||
vim.cmd "packadd packer.nvim"
|
|
||||||
require "plugins"
|
|
||||||
vim.cmd "PackerSync"
|
|
||||||
|
|
||||||
-- install binaries from mason.nvim & tsparsers
|
|
||||||
vim.api.nvim_create_autocmd("User", {
|
|
||||||
pattern = "PackerComplete",
|
|
||||||
callback = function()
|
|
||||||
vim.cmd "bw | silent! MasonInstallAll" -- close packer window
|
|
||||||
require("packer").loader "nvim-treesitter"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
local modules = {
|
require "plugins"
|
||||||
"core.options",
|
|
||||||
"core.packer",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- add binaries installed by mason.nvim to path
|
-- add binaries installed by mason.nvim to path
|
||||||
vim.env.PATH = vim.env.PATH .. ":" .. vim.fn.stdpath "data" .. "/mason/bin"
|
vim.env.PATH = vim.env.PATH .. ":" .. vim.fn.stdpath "data" .. "/mason/bin"
|
||||||
|
|
||||||
for _, module in ipairs(modules) do
|
|
||||||
local ok, err = pcall(require, module)
|
|
||||||
if not ok then
|
|
||||||
error("Error loading " .. module .. "\n\n" .. err)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
require("core.utils").load_mappings()
|
|
||||||
-- require("colors").core_setup()
|
|
||||||
|
|
||||||
require('rose-pine').setup({
|
require('rose-pine').setup({
|
||||||
disable_background = true
|
disable_background = true
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"Comment.nvim": { "branch": "master", "commit": "eab2c83a0207369900e92783f56990808082eac2" },
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "af60ac12fa1349dbad479fc1e95d5aea977c0c37" },
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
|
||||||
|
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||||
|
"crates.nvim": { "branch": "main", "commit": "707ed7d6f8927a5ec0c241aa793f694f1b05f731" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "046e4d3491baf664e0eef5231d28beb49333578b" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "addd6e174a85fc1c4007ab0b65d77e6555b417bf" },
|
||||||
|
"indent-blankline.nvim": { "branch": "master", "commit": "c4c203c3e8a595bc333abaf168fcb10c13ed5fb7" },
|
||||||
|
"kterm": { "branch": "main", "commit": "91bd6e3750a4c9302abe87260256cca97f71666b" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "4739c2d95af17acb786ed33445f59b7b13671417" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "d825d3d1612c31caaff60901e0a6600cab8624d3" },
|
||||||
|
"neovim": { "branch": "main", "commit": "845a6ad5443e3559dde42910c4523a5835c9233b" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "f00eb3b766c370cb34fdabc29c760338ba9e4c6c" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" },
|
||||||
|
"nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "d228bcf7cd94611929482a09e114a42c41fe81a8" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "42c3a3c51e8fef027655e7facd293aae7c6984bb" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826" },
|
||||||
|
"rust-tools.nvim": { "branch": "master", "commit": "df584e84393ef255f5b8cbd709677d6a3a5bf42f" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "2f32775405f6706348b71d0bb8a15a22852a61e4" },
|
||||||
|
"vimwiki": { "branch": "dev", "commit": "fea8bee382b2051b0137fd2cacf0862823ee69b3" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "e4fa445065a2bb0bbc3cca85346b67817f28e83e" }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.lazy = function(install_path)
|
||||||
|
print "Bootstrapping lazy.nvim .."
|
||||||
|
|
||||||
|
vim.fn.system {
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
|
install_path,
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(install_path)
|
||||||
|
|
||||||
|
-- install plugins + compile their configs
|
||||||
|
require "plugins"
|
||||||
|
|
||||||
|
require("lazy").load { plugins = "nvim-treesitter" }
|
||||||
|
|
||||||
|
-- install binaries from mason.nvim & tsparsers on LazySync
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.cmd "bw | silent! MasonInstallAll" -- close lazy window
|
||||||
|
end, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
local M = {}
|
|
||||||
local autocmd = vim.api.nvim_create_autocmd
|
|
||||||
|
|
||||||
-- require("packer").loader(tb.plugins)
|
|
||||||
-- This must be used for plugins that need to be loaded just after a file
|
|
||||||
-- ex : treesitter, lspconfig etc
|
|
||||||
M.lazy_load = function(tb)
|
|
||||||
autocmd(tb.events, {
|
|
||||||
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
|
|
||||||
callback = function()
|
|
||||||
if tb.condition() then
|
|
||||||
vim.api.nvim_del_augroup_by_name(tb.augroup_name)
|
|
||||||
|
|
||||||
-- dont defer for treesitter as it will show slow highlighting
|
|
||||||
-- This deferring only happens only when we do "nvim filename"
|
|
||||||
if tb.plugin ~= "nvim-treesitter" then
|
|
||||||
vim.defer_fn(function()
|
|
||||||
require("packer").loader(tb.plugin)
|
|
||||||
if tb.plugin == "nvim-lspconfig" then
|
|
||||||
vim.cmd "silent! do FileType"
|
|
||||||
end
|
|
||||||
end, 0)
|
|
||||||
else
|
|
||||||
require("packer").loader(tb.plugin)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- load certain plugins only when there's a file opened in the buffer
|
|
||||||
-- if "nvim filename" is executed -> load the plugin after nvim gui loads
|
|
||||||
-- This gives an instant preview of nvim with the file opened
|
|
||||||
|
|
||||||
M.on_file_open = function(plugin_name)
|
|
||||||
M.lazy_load {
|
|
||||||
events = { "BufRead", "BufWinEnter", "BufNewFile" },
|
|
||||||
augroup_name = "BeLazyOnFileOpen" .. plugin_name,
|
|
||||||
plugin = plugin_name,
|
|
||||||
condition = function()
|
|
||||||
local file = vim.fn.expand "%"
|
|
||||||
return file ~= "[packer]" and file ~= ""
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
M.packer_cmds = {
|
|
||||||
"PackerSnapshot",
|
|
||||||
"PackerSnapshotRollback",
|
|
||||||
"PackerSnapshotDelete",
|
|
||||||
"PackerInstall",
|
|
||||||
"PackerUpdate",
|
|
||||||
"PackerSync",
|
|
||||||
"PackerClean",
|
|
||||||
"PackerCompile",
|
|
||||||
"PackerStatus",
|
|
||||||
"PackerProfile",
|
|
||||||
"PackerLoad",
|
|
||||||
}
|
|
||||||
|
|
||||||
M.treesitter_cmds = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSEnable", "TSDisable", "TSModuleInfo" }
|
|
||||||
M.mason_cmds = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" }
|
|
||||||
|
|
||||||
M.gitsigns = function()
|
|
||||||
autocmd({ "BufRead" }, {
|
|
||||||
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
|
|
||||||
callback = function()
|
|
||||||
vim.fn.system("git -C " .. vim.fn.expand "%:p:h" .. " rev-parse")
|
|
||||||
if vim.v.shell_error == 0 then
|
|
||||||
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
|
|
||||||
vim.schedule(function()
|
|
||||||
require("packer").loader "gitsigns.nvim"
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
@ -42,29 +42,3 @@ opt.timeoutlen = 400
|
||||||
|
|
||||||
-- interval for writing swap file to disk, also used by gitsigns
|
-- interval for writing swap file to disk, also used by gitsigns
|
||||||
opt.updatetime = 250
|
opt.updatetime = 250
|
||||||
|
|
||||||
-- disable some builtin vim plugins
|
|
||||||
local default_plugins = {
|
|
||||||
"2html_plugin",
|
|
||||||
"getscript",
|
|
||||||
"getscriptPlugin",
|
|
||||||
"gzip",
|
|
||||||
"logipat",
|
|
||||||
-- "netrw",
|
|
||||||
-- "netrwPlugin",
|
|
||||||
-- "netrwSettings",
|
|
||||||
-- "netrwFileHandlers",
|
|
||||||
"matchit",
|
|
||||||
"tar",
|
|
||||||
"tarPlugin",
|
|
||||||
"rrhelper",
|
|
||||||
"spellfile_plugin",
|
|
||||||
"vimball",
|
|
||||||
"vimball_plugin",
|
|
||||||
"zip",
|
|
||||||
"zipPlugin",
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, plugin in pairs(default_plugins) do
|
|
||||||
g["loaded_" .. plugin] = 1
|
|
||||||
end
|
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
local M = {}
|
|
||||||
|
|
||||||
M.run = function(plugins)
|
|
||||||
local present, packer = pcall(require, "packer")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local final_table = {}
|
|
||||||
for key, _ in pairs(plugins) do
|
|
||||||
plugins[key][1] = key
|
|
||||||
final_table[#final_table + 1] = plugins[key]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
packer.init({
|
|
||||||
auto_clean = true,
|
|
||||||
compile_on_sync = true,
|
|
||||||
git = { clone_timeout = 6000 },
|
|
||||||
display = {
|
|
||||||
working_sym = "ﲊ",
|
|
||||||
error_sym = "✗ ",
|
|
||||||
done_sym = " ",
|
|
||||||
removed_sym = " ",
|
|
||||||
moved_sym = "",
|
|
||||||
open_fn = function()
|
|
||||||
return require("packer.util").float { border = "single" }
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
packer.startup(function(use)
|
|
||||||
for _, v in pairs(final_table) do
|
|
||||||
use(v)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local merge_tb = vim.tbl_deep_extend
|
local merge_tb = vim.tbl_deep_extend
|
||||||
|
|
||||||
|
M.format_plugins = function(plugins) local final_table = {}
|
||||||
|
for key, _ in pairs(plugins) do
|
||||||
|
plugins[key][1] = key
|
||||||
|
final_table[#final_table + 1] = plugins[key]
|
||||||
|
end
|
||||||
|
|
||||||
|
return final_table
|
||||||
|
end
|
||||||
|
|
||||||
M.close_buffer = function(bufnr)
|
M.close_buffer = function(bufnr)
|
||||||
if vim.bo.buftype == "terminal" then
|
if vim.bo.buftype == "terminal" then
|
||||||
vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide")
|
vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide")
|
||||||
|
|
@ -43,4 +52,32 @@ M.load_mappings = function(section, mapping_opt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.lazy_load = function(plugin)
|
||||||
|
vim.api.nvim_create_autocmd({ "BufRead", "BufWinEnter", "BufNewFile" }, {
|
||||||
|
group = vim.api.nvim_create_augroup("BeLazyOnFileOpen" .. plugin, {}),
|
||||||
|
callback = function()
|
||||||
|
local file = vim.fn.expand "%"
|
||||||
|
local condition = file ~= "NvimTree_1" and file ~= "[lazy]" and file ~= ""
|
||||||
|
|
||||||
|
if condition then
|
||||||
|
vim.api.nvim_del_augroup_by_name("BeLazyOnFileOpen" .. plugin)
|
||||||
|
|
||||||
|
-- dont defer for treesitter as it will show slow highlighting
|
||||||
|
-- This deferring only happens only when we do "nvim filename"
|
||||||
|
if plugin ~= "nvim-treesitter" then
|
||||||
|
vim.schedule(function()
|
||||||
|
require("lazy").load { plugins = plugin }
|
||||||
|
|
||||||
|
if plugin == "nvim-lspconfig" then
|
||||||
|
vim.cmd "silent! do FileType"
|
||||||
|
end
|
||||||
|
end, 0)
|
||||||
|
else
|
||||||
|
require("lazy").load { plugins = plugin }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
return {
|
||||||
|
defaults = {
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- install = {
|
||||||
|
-- try to load one of these colorschemes when starting an installation during startup
|
||||||
|
-- colorscheme = { "rose-pine" },
|
||||||
|
-- },
|
||||||
|
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
cmd = " ",
|
||||||
|
config = "",
|
||||||
|
event = "",
|
||||||
|
ft = " ",
|
||||||
|
init = " ",
|
||||||
|
import = " ",
|
||||||
|
keys = " ",
|
||||||
|
lazy = "鈴 ",
|
||||||
|
loaded = "",
|
||||||
|
not_loaded = "",
|
||||||
|
plugin = " ",
|
||||||
|
runtime = " ",
|
||||||
|
source = " ",
|
||||||
|
start = "",
|
||||||
|
task = "✔ ",
|
||||||
|
list = {
|
||||||
|
"●",
|
||||||
|
"➜",
|
||||||
|
"★",
|
||||||
|
"‒",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- performance = {
|
||||||
|
-- rtp = {
|
||||||
|
-- disabled_plugins = {
|
||||||
|
-- "2html_plugin",
|
||||||
|
-- "tohtml",
|
||||||
|
-- "getscript",
|
||||||
|
-- "getscriptPlugin",
|
||||||
|
-- "gzip",
|
||||||
|
-- "logipat",
|
||||||
|
-- -- "netrw",
|
||||||
|
-- -- "netrwPlugin",
|
||||||
|
-- -- "netrwSettings",
|
||||||
|
-- -- "netrwFileHandlers",
|
||||||
|
-- "matchit",
|
||||||
|
-- "tar",
|
||||||
|
-- "tarPlugin",
|
||||||
|
-- "rrhelper",
|
||||||
|
-- "spellfile_plugin",
|
||||||
|
-- "vimball",
|
||||||
|
-- "vimballPlugin",
|
||||||
|
-- "zip",
|
||||||
|
-- "zipPlugin",
|
||||||
|
-- "tutor",
|
||||||
|
-- "rplugin",
|
||||||
|
-- "syntax",
|
||||||
|
-- "synmenu",
|
||||||
|
-- "optwin",
|
||||||
|
-- "compiler",
|
||||||
|
-- "bugreport",
|
||||||
|
-- "ftplugin",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
}
|
||||||
|
|
@ -20,30 +20,31 @@ M.autopairs = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.luasnip = function()
|
M.luasnip = function()
|
||||||
local present, luasnip = pcall(require, "luasnip")
|
local present, luasnip = pcall(require, "luasnip")
|
||||||
|
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
history = true,
|
history = true,
|
||||||
updateevents = "TextChanged,TextChangedI",
|
updateevents = "TextChanged,TextChangedI",
|
||||||
}
|
}
|
||||||
|
|
||||||
luasnip.config.set_config(options)
|
luasnip.config.set_config(options)
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
||||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||||
callback = function()
|
callback = function()
|
||||||
if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
if
|
||||||
and not require("luasnip").session.jump_active
|
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||||
then
|
and not require("luasnip").session.jump_active
|
||||||
require("luasnip").unlink_current()
|
then
|
||||||
end
|
require("luasnip").unlink_current()
|
||||||
end,
|
end
|
||||||
})
|
end,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
M.gitsigns = function()
|
M.gitsigns = function()
|
||||||
|
|
@ -99,7 +100,7 @@ M.blankline = function()
|
||||||
"help",
|
"help",
|
||||||
"terminal",
|
"terminal",
|
||||||
"alpha",
|
"alpha",
|
||||||
"packer",
|
"lazy",
|
||||||
"lspinfo",
|
"lspinfo",
|
||||||
"TelescopePrompt",
|
"TelescopePrompt",
|
||||||
"TelescopeResults",
|
"TelescopeResults",
|
||||||
|
|
@ -136,6 +137,7 @@ M.colorizer = function()
|
||||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||||
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||||
mode = "background", -- Set the display mode.
|
mode = "background", -- Set the display mode.
|
||||||
|
tailwind = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,46 @@
|
||||||
|
-- All plugins have lazy = true by default, to load a plugin on startup just lazy=false
|
||||||
local plugins = {
|
local plugins = {
|
||||||
["wbthomason/packer.nvim"] = {
|
['nvim-lua/plenary.nvim'] = {},
|
||||||
cmd = require("core.lazy_load").packer_cmds,
|
|
||||||
config = function()
|
|
||||||
require "plugins"
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
["nvim-treesitter/nvim-treesitter"] = {
|
["nvim-treesitter/nvim-treesitter"] = {
|
||||||
module = "nvim-treesitter",
|
init = function()
|
||||||
setup = function()
|
require("core.utils").lazy_load "nvim-treesitter"
|
||||||
require("core.lazy_load").on_file_open "nvim-treesitter"
|
|
||||||
end,
|
end,
|
||||||
cmd = require("core.lazy_load").treesitter_cmds,
|
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSEnable", "TSDisable", "TSModuleInfo" },
|
||||||
run = ":TSUpdate",
|
run = ":TSUpdate",
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.treesitter"
|
require "plugins.configs.treesitter"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- git
|
|
||||||
["lewis6991/gitsigns.nvim"] = {
|
["lewis6991/gitsigns.nvim"] = {
|
||||||
ft = "gitcommit",
|
ft = "gitcommit",
|
||||||
setup = function()
|
init = function()
|
||||||
require("core.lazy_load").gitsigns()
|
-- load gitsigns only when a git file is opened
|
||||||
|
vim.api.nvim_create_autocmd({ "BufRead" }, {
|
||||||
|
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
|
||||||
|
callback = function()
|
||||||
|
vim.fn.system("git -C " .. vim.fn.expand "%:p:h" .. " rev-parse")
|
||||||
|
if vim.v.shell_error == 0 then
|
||||||
|
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
|
||||||
|
vim.schedule(function()
|
||||||
|
require("lazy").load { plugins = "gitsigns.nvim" }
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
require("plugins.configs.others").gitsigns()
|
require("plugins.configs.others").gitsigns()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
['nvim-lua/plenary.nvim'] = {},
|
|
||||||
|
|
||||||
["nvim-telescope/telescope.nvim"] = {
|
["nvim-telescope/telescope.nvim"] = {
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.telescope"
|
require "plugins.configs.telescope"
|
||||||
end,
|
end,
|
||||||
setup = function()
|
init = function()
|
||||||
require("core.utils").load_mappings "telescope"
|
require("core.utils").load_mappings "telescope"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
@ -44,16 +48,15 @@ local plugins = {
|
||||||
-- lsp stuff
|
-- lsp stuff
|
||||||
|
|
||||||
["williamboman/mason.nvim"] = {
|
["williamboman/mason.nvim"] = {
|
||||||
cmd = require("core.lazy_load").mason_cmds,
|
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.mason"
|
require "plugins.configs.mason"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
["neovim/nvim-lspconfig"] = {
|
["neovim/nvim-lspconfig"] = {
|
||||||
opt = true,
|
init = function()
|
||||||
setup = function()
|
require("core.utils").lazy_load "nvim-lspconfig"
|
||||||
require("core.lazy_load").on_file_open "nvim-lspconfig"
|
|
||||||
end,
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.lspconfig"
|
require "plugins.configs.lspconfig"
|
||||||
|
|
@ -77,43 +80,40 @@ local plugins = {
|
||||||
|
|
||||||
-- load luasnips + cmp related in insert mode only
|
-- load luasnips + cmp related in insert mode only
|
||||||
|
|
||||||
["rafamadriz/friendly-snippets"] = {},
|
["hrsh7th/nvim-cmp"] = {
|
||||||
|
event = "InsertEnter",
|
||||||
["hrsh7th/nvim-cmp"] = {
|
dependencies = {
|
||||||
event = "InsertEnter",
|
{
|
||||||
|
-- snippet plugin
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
dependencies = "rafamadriz/friendly-snippets",
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.cmp"
|
require("plugins.configs.others").luasnip()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
["L3MON4D3/LuaSnip"] = {
|
-- autopairing of (){}[] etc
|
||||||
requires = "friendly-snippets",
|
{
|
||||||
after = "nvim-cmp",
|
"windwp/nvim-autopairs",
|
||||||
config = function()
|
config = function()
|
||||||
require("plugins.configs.others").luasnip()
|
require("plugins.configs.others").autopairs()
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- cmp sources plugins
|
||||||
|
{
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"hrsh7th/cmp-nvim-lua",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
["saadparwaiz1/cmp_luasnip"] = {
|
config = function()
|
||||||
after = "LuaSnip",
|
require "plugins.configs.cmp"
|
||||||
},
|
end,
|
||||||
|
},
|
||||||
["hrsh7th/cmp-nvim-lua"] = {
|
|
||||||
after = "cmp_luasnip",
|
|
||||||
},
|
|
||||||
|
|
||||||
["hrsh7th/cmp-nvim-lsp"] = {
|
|
||||||
after = "cmp-nvim-lua",
|
|
||||||
},
|
|
||||||
|
|
||||||
["hrsh7th/cmp-buffer"] = {
|
|
||||||
after = "cmp-nvim-lsp",
|
|
||||||
},
|
|
||||||
|
|
||||||
["hrsh7th/cmp-path"] = {
|
|
||||||
after = "cmp-buffer",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- misc
|
-- misc
|
||||||
|
|
||||||
['vimwiki/vimwiki'] = {
|
['vimwiki/vimwiki'] = {
|
||||||
|
|
@ -128,30 +128,21 @@ local plugins = {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
["windwp/nvim-autopairs"] = {
|
|
||||||
after = "nvim-cmp",
|
|
||||||
config = function()
|
|
||||||
require("plugins.configs.others").autopairs()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
["numToStr/Comment.nvim"] = {
|
["numToStr/Comment.nvim"] = {
|
||||||
module = "Comment",
|
-- keys = { "gc", "gb" },
|
||||||
keys = { "gc", "gb" },
|
|
||||||
config = function()
|
config = function()
|
||||||
require("plugins.configs.others").comment()
|
require("plugins.configs.others").comment()
|
||||||
end,
|
end,
|
||||||
setup = function()
|
init = function()
|
||||||
require("core.utils").load_mappings "comment"
|
require("core.utils").load_mappings "comment"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
["krolyxon/kterm"] = {
|
["krolyxon/kterm"] = {
|
||||||
module = "kterm",
|
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.kterm"
|
require "plugins.configs.kterm"
|
||||||
end,
|
end,
|
||||||
setup = function()
|
init = function()
|
||||||
require("core.utils").load_mappings "kterm"
|
require("core.utils").load_mappings "kterm"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
@ -163,15 +154,16 @@ local plugins = {
|
||||||
config = function()
|
config = function()
|
||||||
require("plugins.configs.others").blankline()
|
require("plugins.configs.others").blankline()
|
||||||
end,
|
end,
|
||||||
setup = function()
|
init = function()
|
||||||
|
require("core.utils").lazy_load "indent-blankline.nvim"
|
||||||
require("core.utils").load_mappings "blankline"
|
require("core.utils").load_mappings "blankline"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
["nvchad/nvim-colorizer.lua"] = {
|
["nvchad/nvim-colorizer.lua"] = {
|
||||||
opt = true,
|
opt = true,
|
||||||
setup = function()
|
init = function()
|
||||||
require("core.lazy_load").on_file_open "nvim-colorizer.lua"
|
require("core.utils").lazy_load "nvim-colorizer.lua"
|
||||||
end,
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
require("plugins.configs.others").colorizer()
|
require("plugins.configs.others").colorizer()
|
||||||
|
|
@ -186,20 +178,26 @@ local plugins = {
|
||||||
|
|
||||||
-- Only load whichkey after all the gui
|
-- Only load whichkey after all the gui
|
||||||
["folke/which-key.nvim"] = {
|
["folke/which-key.nvim"] = {
|
||||||
disable = false,
|
enabled = true,
|
||||||
module = "which-key",
|
|
||||||
keys = { "<leader>", "\"", "'", "`" },
|
keys = { "<leader>", "\"", "'", "`" },
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.whichkey"
|
require "plugins.configs.whichkey"
|
||||||
end,
|
end,
|
||||||
setup = function()
|
init = function()
|
||||||
require("core.utils").load_mappings "whichkey"
|
require("core.utils").load_mappings "whichkey"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
["rose-pine/neovim"] = {},
|
["rose-pine/neovim"] = {},
|
||||||
|
|
||||||
-- speed up deffered plugins
|
|
||||||
["lewis6991/impatient.nvim"] = {},
|
|
||||||
}
|
}
|
||||||
require("core.packer").run(plugins)
|
|
||||||
|
plugins = require("core.utils").format_plugins(plugins)
|
||||||
|
|
||||||
|
-- pin commits for all default plugins
|
||||||
|
for _, value in pairs(plugins) do
|
||||||
|
value.pin = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- load lazy.nvim options
|
||||||
|
local lazy_config = require "plugins.configs.lazy_nvim"
|
||||||
|
require("lazy").setup(plugins, lazy_config)
|
||||||
|
|
|
||||||
Reference in New Issue