packer.nvim icon indicating copy to clipboard operation
packer.nvim copied to clipboard

Weird PackerSync behaviour

Open budimanjojo opened this issue 3 years ago • 1 comments

  • nvim --version: NVIM v0.6.0 Build type: Release LuaJIT 2.0.5 Compiled by builduser

  • git --version: git version 2.34.1

  • Operating system/version: Arch Linux

  • Terminal name/version: alacritty

Steps to reproduce

I have an autocommand to do PackerSync whenever I save my plugins.lua file. It was working fine until today. I don't know if this is due to nvim 0.6 or packer latest update. Whenever I save the file, it will ask me to remove all my plugins, which are inside my startup(function(use)). But when I manually do 'PackerSync` in nvim command, it will work fine.

Actual behaviour

Popup showing Removing the following directories. OK? (y/n)

Expected behaviour

Popup showing syncing and Everything already up to date!

packer files

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
    Packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end

require('packer').startup({function(use)
    use 'wbthomason/packer.nvim'
    if Packer_bootstrap then
        require('packer').sync()
    end
end,

config = {
    display = {
        open_fn = function()
            return require('packer.util').float({ border = 'single' })
        end
    }
}
})

vim.cmd([[
    augroup packer_user_config
        autocmd!
        autocmd BufWritePost plugins.lua source <afile> | PackerSync
    augroup END
]])

budimanjojo avatar Dec 01 '21 16:12 budimanjojo

Make sure you are pointing to the right path e.g like shown below:

vim.cmd([[
    augroup packer_user_config
        autocmd!
        autocmd BufWritePost ~/path/to/plugins.lua source <afile> | PackerSync
    augroup END
]])

Pheon-Dev avatar Oct 23 '22 17:10 Pheon-Dev