From 8f434895b097de234b454fad530f4059333e5e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 28 Apr 2022 17:21:55 +0200 Subject: [PATCH] Move packer installation to workflow instead of neovim --- .github/workflows/main.yml | 2 ++ .github/workflows/neovim-nightly-test.yml | 2 ++ Makefile | 5 +++-- symlinks/config/nvim/init.lua | 2 +- symlinks/config/nvim/lua/init/first_load.lua | 15 +++++---------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 854f945..b6f5952 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,8 @@ jobs: uses: rhysd/action-setup-vim@v1 with: neovim: true + - name: Install packer + run: git clone https://github.com/wbthomason/packer.nvim /share/nvim/site/pack/packer/start/packer.nvim - name: Run neovim checks run: make check_neovim env: diff --git a/.github/workflows/neovim-nightly-test.yml b/.github/workflows/neovim-nightly-test.yml index f6310cd..a5dd84f 100644 --- a/.github/workflows/neovim-nightly-test.yml +++ b/.github/workflows/neovim-nightly-test.yml @@ -23,6 +23,8 @@ jobs: with: neovim: true version: nightly + - name: Install packer + run: git clone https://github.com/wbthomason/packer.nvim /share/nvim/site/pack/packer/start/packer.nvim - name: Run neovim checks run: make check_neovim env: diff --git a/Makefile b/Makefile index 54cd4b1..fb6527f 100644 --- a/Makefile +++ b/Makefile @@ -314,9 +314,10 @@ install_vim: check_os link_vim .PHONY: check_neovim check_neovim: check_os - @echo "Running vim config basic test" - @FORCE_PACKER_INSTALL=1 nvim --headless -c 'autocmd User PackerComplete quitall' + @echo "This expects that packer is already installed" + @echo "Installing packer packages" @nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerInstall' + @echo "Doing a basic neovim startup and quit" @nvim --headless -c 'quitall' .PHONY: oh_my_zsh diff --git a/symlinks/config/nvim/init.lua b/symlinks/config/nvim/init.lua index 1f48948..6c28aa4 100644 --- a/symlinks/config/nvim/init.lua +++ b/symlinks/config/nvim/init.lua @@ -1,4 +1,4 @@ -if require("init.first_load")(os.getenv("FORCE_PACKER_INSTALL") ~= nil) then +if require("init.first_load")() then return end diff --git a/symlinks/config/nvim/lua/init/first_load.lua b/symlinks/config/nvim/lua/init/first_load.lua index d26ffef..c67add9 100644 --- a/symlinks/config/nvim/lua/init/first_load.lua +++ b/symlinks/config/nvim/lua/init/first_load.lua @@ -1,9 +1,7 @@ -- Adopted from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/tj/first_load.lua -local download_packer = function(force) - if not force then - if vim.fn.input("Download Packer? (y for yes)") ~= "y" then - return - end +local download_packer = function() + if vim.fn.input("Download Packer? (y for yes)") ~= "y" then + return end local directory = string.format("%s/site/pack/packer/start/", vim.fn.stdpath("data")) @@ -19,14 +17,11 @@ local download_packer = function(force) vim.api.nvim_command("PackerCompile") vim.api.nvim_command("PackerInstall") print("( You'll need to restart now )") - if force then - vim.api.nvim_command("quitall") - end end -return function(force) +return function() if not pcall(require, "packer") then - download_packer(force) + download_packer() return true end