neovim: move to vim.pack from lazy
This commit is contained in:
@@ -1,89 +1,79 @@
|
||||
-- Install lazy automagically
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
local pack = require("pack")
|
||||
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
{ "nvim-treesitter/playground" },
|
||||
pack.add("kyazdani42/nvim-web-devicons")
|
||||
pack.add("nvim-lua/plenary.nvim")
|
||||
|
||||
{
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
config = function()
|
||||
require("ts_context_commentstring").setup({})
|
||||
vim.g.skip_ts_context_commentstring_module = true
|
||||
end,
|
||||
},
|
||||
pack.add("nvim-tree/nvim-tree.lua")
|
||||
|
||||
{ "nvim-telescope/telescope.nvim" },
|
||||
pack.add("nvim-lualine/lualine.nvim")
|
||||
|
||||
{ "tpope/vim-fugitive" },
|
||||
{ "lewis6991/gitsigns.nvim" },
|
||||
pack.add("nvim-telescope/telescope.nvim")
|
||||
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "hrsh7th/cmp-cmdline" },
|
||||
{ "petertriho/cmp-git" },
|
||||
},
|
||||
},
|
||||
pack.add({
|
||||
src = "nvim-treesitter/nvim-treesitter",
|
||||
version = "master",
|
||||
})
|
||||
pack.add("windwp/nvim-ts-autotag")
|
||||
pack.add("windwp/nvim-autopairs")
|
||||
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
},
|
||||
pack.add("tpope/vim-fugitive")
|
||||
pack.add("lewis6991/gitsigns.nvim")
|
||||
|
||||
{ "nvimtools/none-ls.nvim", dependencies = {
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
} },
|
||||
pack.add("numToStr/Comment.nvim")
|
||||
pack.add("JoosepAlviste/nvim-ts-context-commentstring")
|
||||
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
dependencies = {
|
||||
{ "kyazdani42/nvim-web-devicons" },
|
||||
},
|
||||
},
|
||||
pack.add("b0o/SchemaStore.nvim")
|
||||
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
config = function()
|
||||
require("oil").setup({
|
||||
default_file_explorer = false,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{ "windwp/nvim-autopairs", opts = {} },
|
||||
{ "windwp/nvim-ts-autotag" },
|
||||
|
||||
{ "numToStr/Comment.nvim" },
|
||||
|
||||
{ "nvim-lualine/lualine.nvim" },
|
||||
|
||||
{ "b0o/SchemaStore.nvim" },
|
||||
pack.add({
|
||||
src = "L3MON4D3/LuaSnip",
|
||||
deps = {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
})
|
||||
|
||||
pack.add({
|
||||
src = "hrsh7th/nvim-cmp",
|
||||
deps = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"petertriho/cmp-git",
|
||||
},
|
||||
})
|
||||
|
||||
pack.add({
|
||||
src = "nvimtools/none-ls.nvim",
|
||||
deps = {
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("PackUpdate", function()
|
||||
vim.pack.update()
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("PackClean", function()
|
||||
local plugins = vim.pack.get()
|
||||
|
||||
local items = {}
|
||||
|
||||
for _, plug in ipairs(plugins) do
|
||||
if not plug.active then
|
||||
table.insert(items, plug.spec.name)
|
||||
end
|
||||
end
|
||||
|
||||
if #items == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
vim.pack.del(items)
|
||||
|
||||
local msg = "Deleted " .. #items .. " plugins"
|
||||
vim.notify(msg)
|
||||
end, {})
|
||||
|
||||
Reference in New Issue
Block a user