From a28eae433a14cbe940f3c51f8b05d59ec5df0cc0 Mon Sep 17 00:00:00 2001 From: Nefrace Date: Mon, 10 Jun 2024 04:58:49 +0300 Subject: [PATCH] Modified to ensure Packer installed --- after/plugin/lsp.lua | 2 +- lua/nefrace/init.lua | 2 ++ lua/nefrace/packerensure.lua | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 lua/nefrace/packerensure.lua diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 48d8de2..d316acc 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -40,7 +40,7 @@ require'lspconfig'.gdscript.setup{} require('mason').setup({}) require('mason-lspconfig').setup({ - ensure_installed = {'tsserver', 'eslint', 'rust_analyzer', 'gopls'}, + ensure_installed = {'rust_analyzer', 'gopls'}, handlers = { lsp.default_setup, lua_ls = function() diff --git a/lua/nefrace/init.lua b/lua/nefrace/init.lua index 727c90d..ddb7bbf 100644 --- a/lua/nefrace/init.lua +++ b/lua/nefrace/init.lua @@ -1,2 +1,4 @@ +require("nefrace.packerensure") +require("nefrace.packer") require("nefrace.remap") require("nefrace.set") diff --git a/lua/nefrace/packerensure.lua b/lua/nefrace/packerensure.lua new file mode 100644 index 0000000..cd90901 --- /dev/null +++ b/lua/nefrace/packerensure.lua @@ -0,0 +1,25 @@ +local ensure_packer = function() + local fn = vim.fn + local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.cmd [[packadd packer.nvim]] + return true + end + return false +end + +local packer_bootstrap = ensure_packer() + +return require('nefrace.packer').startup(function(use) + use 'wbthomason/packer.nvim' + -- My plugins here + -- use 'foo1/bar1.nvim' + -- use 'foo2/bar2.nvim' + + -- Automatically set up your configuration after cloning packer.nvim + -- Put this at the end after all plugins + if packer_bootstrap then + require('nefrace.packer').sync() + end +end)