Skip to content

Defined plugins in 'custom.plugins' are not synced #34

Description

@BKDevelop

The latest change introduced the option to use a seperate file for defining plugins ootb. At least on my machine, this does not seem to work as expected.

How to reproduce

  1. check out kickstart.nvim in ~/.config/nvim
  2. add file lua/costum/plugins.lua
  3. copy relevant snippet from Readme
  4. save and reopen neovim
  5. run :PackerSync
  6. no new plugins are added :(

Can anybody reproduce this, or is there something wrong with my setup? Thx

Activity

  1. tjdevries commented on Nov 25, 2022

    @tjdevries
    Member

    can you show your exact custom/plugins file? And to be clear, you put it in custom/plugins not costom/plugins right?

  2. BKDevelop commented on Nov 30, 2022

    @BKDevelop
    Author

    Sorry for the late reply. Had the chance to try this on a different machine today... It works just fine!

    I assume PEBKAC on my last attempt - sorry for the inconvinience!

  3. tjdevries commented on Dec 1, 2022

    @tjdevries
    Member

    No problem at all :) have a good day

  4. jby commented on Feb 12, 2023

    @jby

    I'm seeing the exact same behaviour here.
    My $HOME/.config/nvim/custom/plugins.lua:

    return function(use)
      use({
    	'nvim-tree/nvim-tree.lua'
    	config = function()
    		require("nvim-tree").setup()
    	'nvim-tree/nvim-web-devicons'
    	end
    	})
    
  5. BKDevelop commented on Feb 12, 2023

    @BKDevelop
    Author

    I think the file needs to be located at

    $HOME/.config/nvim/lua/custom/plugins.lua

  6. jby commented on Feb 12, 2023

    @jby

    Yes, sorry - my mistake... :(

  7. jby commented on Feb 13, 2023

    @jby

    However, it would seem that the custom/plugins.lua is only read for config of the plugin. Packer doesn't seem to see any plugins included in it...
    I now have 3 plugins configured in it:

    return function(use)
    -- Configure nvim-tree
      use({
    	'nvim-tree/nvim-tree.lua'
    	config = function()
    		require("nvim-tree").setup()
    	'nvim-tree/nvim-web-devicons'
    	end
    -- Add friendly snippets
      use({
    	'rafamadriz/friendly-snippets'
    	config = function ()
    		require("friendly-snippets").setup()
    	end
    	})
    end
    

    and it never installs 'friendly-snippets', and if I run PackerSync manually it always asks if it can remove the unused nvim-tree plugins... (which were installed when I had them in init.lua, which was when I had the wrong path to my custom/plugins.lua)
    It does read the nvim-tree config though, since I can create a keymap for it in my after/plugin/defaults.lua...
    What am I doing wrong?

  8. LudoPinelli commented on Feb 13, 2023

    @LudoPinelli

    Hi @jby,
    It works fine for me, have you tried :PackerInstall (before:PackerSync)?
    Also, for PackerSync always asking to remove the old nvim-tree, you can try to delete this folders:
    ~/.config/cache/nvim
    It will rebuild it the next time you launch neovim.

    EDIT: also for friendly-snippets to be taken into account by luasnip you have to replace the line require('friendly-snippets').setup() whith require('luasnip.loader.from_vscode').lazy_load().

  9. jby commented on Feb 13, 2023

    @jby

    I'd guess it's these (rather than ~/.config/cache/nvim, especially since I don't have a cache dir in ~/.config) that I should remove?
    image
    However a :PackerInstall does nothing...

  10. jby commented on Feb 13, 2023

    @jby

    I'm pretty sure though, that if I were to remove the above I would no longer have the nvim-tree plugin installed...

  11. LudoPinelli commented on Feb 13, 2023

    @LudoPinelli

    You can remove ~/.local/share/nvim, it will reset your config and reinstall everything (you may have to restart neovim a couple of time for everything to be set up).

    I don't knwow if the custom/plugins.lua you showed is only a snippet or the entire file. If it is the entire file, a }) is missing, also nvim-web-devicons should be required. Here is the file with the corrections :

    return function(use)
    -- Configure nvim-tree
      use({
    	{'nvim-tree/nvim-tree.lua', requires = 'nvim-tree/nvim-web-devicons'},
    	config = function()
    		require("nvim-tree").setup()
    	'nvim-tree/nvim-web-devicons'
    	end
    	})
    -- Add friendly snippets
      use({
    	'rafamadriz/friendly-snippets'
    	config = function ()
    		require("luasnip.loaders.from_vscode").lazy_load()
    	end
    	})
    end
    
  12. jby commented on Feb 13, 2023

    @jby

    Ok, thanks - but still - no install of the plugins in the custom file.
    I did remove ~/.local/share/nvim and when I restarted it re-installed everything again - but not the plugins in the custom file:
    image

  13. jby commented on Feb 13, 2023

    @jby

    Albeit it does look for it since I've configured it...

    Error detected while processing /Users/jonasb/src/jby/nvim/after/plugin/defaults.lua:
    E5113: Error while calling lua chunk: /Users/jonasb/src/jby/nvim/after/plugin/defaults.lua:4: module 'nvim-tree' not found:
            no field package.preload['nvim-tree']
            no file './nvim-tree.lua'
            no file '/usr/local/share/luajit-2.1.0-beta3/nvim-tree.lua'
            no file '/usr/local/share/lua/5.1/nvim-tree.lua'
            no file '/usr/local/share/lua/5.1/nvim-tree/init.lua'
            no file '/Users/jonasb/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/nvim-tree.lua'
            no file '/Users/jonasb/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/nvim-tree/init.lua'
            no file '/Users/jonasb/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/nvim-tree.lua'
            no file '/Users/jonasb/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/nvim-tree/init.lua'
            no file './nvim-tree.so'
            no file '/usr/local/lib/lua/5.1/nvim-tree.so'
            no file '/usr/local/lib/lua/5.1/loadall.so'
            no file '/Users/jonasb/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/nvim-tree.so'
    stack traceback:
            [C]: in function 'require'
            /Users/jonasb/src/jby/nvim/after/plugin/defaults.lua:4: in main chunk
    
  14. jby commented on Feb 13, 2023

    @jby

    So - the ~/.config/nvim/after/plugin/defaults.lua definitively is read, but apparently not the ~/.config/nvim/lua/custom/plugins.lua

  15. jby commented on Feb 13, 2023

    @jby

    Hmm, my ~/.config/nvim/lua/custom/plugins.lua doesn't even seem to be read even if I ignore the logic that's supposed to look for it and manually specify it in init.lua like this:

    (require 'custom.plugins')
    

    My ~/.config/nvim/lua/custom/plugins.lua now:

    return function(use)
      -- Configure nvim-tree
      use({
        {'nvim-tree/nvim-tree.lua', requires = 'nvim-tree/nvim-web-devicons'},
        config = function()
          require("nvim-tree").setup()
          'nvim-tree/nvim-web-devicons'
        end
      })
      -- Add friendly snippets
      use({
        'rafamadriz/friendly-snippets',
        config = function ()
          require('luasnip.loader.from_vscode').lazy_load()
        end
      })
      -- // Comment.nvim
      use {
        'numToStr/Comment.nvim',
        config = function()
          require('Comment').setup()
        end
      }
    end
  16. jby commented on Feb 13, 2023

    @jby

    The only way, so far I get the plugins I want to add to actually be installed and used is to add them to init.lua...
    Doesn't that kind of make the custom.plugins rather useless?

  17. LudoPinelli commented on Feb 13, 2023

    @LudoPinelli

    Doesn't that kind of make the custom.plugins rather useless?

    Sure but it seems that you are the only one with this problem, I'm sorry, I'm running out of ideas.

  18. jby commented on Feb 13, 2023

    @jby

    I kind of feel like I've hi-jacked someone else's, already closed, issue here. Maybe I should create my own instead?

  19. jby commented on Feb 13, 2023

    @jby

    Created #176 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions