lazy-nvim plugin and formatting
This commit is contained in:
parent
a1919bafc7
commit
8b437e4177
16
init.lua
16
init.lua
|
|
@ -4,14 +4,14 @@ require("core.utils").load_mappings()
|
|||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
require "plugins"
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
local M = {}
|
||||
|
||||
M.lazy = function(install_path)
|
||||
print "Bootstrapping lazy.nvim .."
|
||||
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.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)
|
||||
vim.opt.rtp:prepend(install_path)
|
||||
|
||||
-- install plugins + compile their configs
|
||||
require "plugins"
|
||||
-- install plugins + compile their configs
|
||||
require "plugins"
|
||||
|
||||
require("lazy").load { plugins = "nvim-treesitter" }
|
||||
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)
|
||||
-- install binaries from mason.nvim & tsparsers on LazySync
|
||||
vim.schedule(function()
|
||||
vim.cmd "bw | silent! MasonInstallAll" -- close lazy window
|
||||
end, 0)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ M.format_plugins = function(plugins) local final_table = {}
|
|||
final_table[#final_table + 1] = plugins[key]
|
||||
end
|
||||
|
||||
return final_table
|
||||
return final_table
|
||||
end
|
||||
|
||||
M.close_buffer = function(bufnr)
|
||||
|
|
@ -53,31 +53,31 @@ M.load_mappings = function(section, mapping_opt)
|
|||
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 ~= ""
|
||||
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)
|
||||
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 }
|
||||
-- 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"
|
||||
if plugin == "nvim-lspconfig" then
|
||||
vim.cmd "silent! do FileType"
|
||||
end
|
||||
end, 0)
|
||||
else
|
||||
require("lazy").load { plugins = plugin }
|
||||
end
|
||||
end
|
||||
end, 0)
|
||||
else
|
||||
require("lazy").load { plugins = plugin }
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -1,70 +1,49 @@
|
|||
return {
|
||||
defaults = {
|
||||
lazy = true,
|
||||
},
|
||||
defaults = {
|
||||
lazy = true,
|
||||
},
|
||||
|
||||
-- install = {
|
||||
-- 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 = {
|
||||
"●",
|
||||
"➜",
|
||||
"★",
|
||||
"‒",
|
||||
},
|
||||
ui = {
|
||||
icons = {
|
||||
ft = "",
|
||||
lazy = "鈴 ",
|
||||
loaded = "",
|
||||
not_loaded = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- 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",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"2html_plugin",
|
||||
"tohtml",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
"syntax",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
"compiler",
|
||||
"bugreport",
|
||||
"ftplugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ local plugins = {
|
|||
-- lsp stuff
|
||||
|
||||
["williamboman/mason.nvim"] = {
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
|
||||
config = function()
|
||||
require "plugins.configs.mason"
|
||||
end,
|
||||
|
|
@ -82,40 +82,40 @@ local plugins = {
|
|||
|
||||
-- load luasnips + cmp related in insert mode only
|
||||
|
||||
["hrsh7th/nvim-cmp"] = {
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{
|
||||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("plugins.configs.others").luasnip()
|
||||
end,
|
||||
},
|
||||
["hrsh7th/nvim-cmp"] = {
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{
|
||||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("plugins.configs.others").luasnip()
|
||||
end,
|
||||
},
|
||||
|
||||
-- autopairing of (){}[] etc
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("plugins.configs.others").autopairs()
|
||||
end,
|
||||
},
|
||||
-- autopairing of (){}[] etc
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("plugins.configs.others").autopairs()
|
||||
end,
|
||||
},
|
||||
|
||||
-- cmp sources plugins
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
-- cmp sources plugins
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
},
|
||||
|
||||
config = function()
|
||||
require "plugins.configs.cmp"
|
||||
end,
|
||||
},
|
||||
|
||||
config = function()
|
||||
require "plugins.configs.cmp"
|
||||
end,
|
||||
},
|
||||
-- misc
|
||||
|
||||
['vimwiki/vimwiki'] = {
|
||||
|
|
@ -198,7 +198,7 @@ plugins = require("core.utils").format_plugins(plugins)
|
|||
|
||||
-- pin commits for all default plugins
|
||||
for _, value in pairs(plugins) do
|
||||
value.pin = true
|
||||
value.pin = true
|
||||
end
|
||||
|
||||
-- load lazy.nvim options
|
||||
|
|
|
|||
Reference in New Issue