From 4c6627deed1e5de61342a7803ef7928a923cf557 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Wed, 30 Nov 2022 00:21:44 -0800 Subject: [PATCH] Auto download packages on first launch --- init.fnl | 9 +++++++-- init.lua | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/init.fnl b/init.fnl index 3ccb0e2..dcaa6ab 100644 --- a/init.fnl +++ b/init.fnl @@ -509,6 +509,8 @@ (use! :neovim/nvim-lspconfig :after :cmp-nvim-lsp :config lsp_config_callback) + + ;; nvim-jdtls (fn jdtls_config_callback [] (hook! :FileType :java #(let [root_dir ((. (require :jdtls.setup) :find_root) @@ -524,8 +526,11 @@ :jdtls root_dir) ]})))) (use! :mfussenegger/nvim-jdtls :after :nvim-lspconfig - :config jdtls_config_callback)) + :config jdtls_config_callback) + + ;; Sync all packages on first launch + (if _G.zander.first_launch + ((. (require :packer) :sync)))) -(vim.cmd.packadd "packer.nvim") (let [packer (require :packer)] (packer.startup packer_init_callback)) diff --git a/init.lua b/init.lua index 6387dc8..2cd602a 100644 --- a/init.lua +++ b/init.lua @@ -3,10 +3,13 @@ local function bootstrap(pkg, repo) if vim.fn.isdirectory(plug_dir) ~= 1 then vim.fn.system({ 'git', 'clone', '--depth', '1', repo, plug_dir }) vim.cmd.packadd(pkg) + return true end + return false end -bootstrap('packer.nvim', 'https://github.com/wbthomason/packer.nvim') +_G.zander = {} +_G.zander.first_launch = bootstrap('packer.nvim', 'https://github.com/wbthomason/packer.nvim') bootstrap('tangerine.nvim', 'https://github.com/udayvir-singh/tangerine.nvim') require('tangerine').setup({