Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking Change - New Plugin Manager: lazy.nvim #27

Closed
brainfucksec opened this issue Feb 19, 2023 · 6 comments
Closed

Breaking Change - New Plugin Manager: lazy.nvim #27

brainfucksec opened this issue Feb 19, 2023 · 6 comments
Assignees
Labels
breaking change Require manual intervention important Important or critical changes

Comments

@brainfucksec
Copy link
Owner

brainfucksec commented Feb 19, 2023

As of today (Feb. 25, 2023) lazy.nvim is used as the plugin manager instead of packer.

See commit: 2db1c38

Details

Old package: packer.nvim

New package: lazy.nvim

Directories

Changing the plugin manager involves changing the directory structure of Neovim.

Old Neovim directory structure with packer:

${HOME}/.config/nvim/

nvim/
├── lua
│   ├── core
│   │   ├── autocmds.lua
│   │   ├── colors.lua
│   │   ├── keymaps.lua
│   │   ├── options.lua
│   │   └── statusline.lua
│   ├── lsp
│   │   └── lspconfig.lua
│   ├── plugins
│   │   ├── alpha-nvim.lua
│   │   ├── indent-blankline.lua
│   │   ├── nvim-cmp.lua
│   │   ├── nvim-tree.lua
│   │   └── nvim-treesitter.lua
│   └── packer_init.lua
├── plugin
│   └── packer_compiled.lua
└── init.lua

Files to be removed:

~/.config/nvim/lua/packer_init.lua
~/.config/nvim/plugin/packer_compiled.lua

New Neovim directory structure with lazy.nvim:

nvim/
├── lua
│   ├── core
│   │   ├── autocmds.lua
│   │   ├── colors.lua
│   │   ├── keymaps.lua
│   │   ├── lazy.lua
│   │   ├── options.lua
│   │   └── statusline.lua
│   ├── lsp
│   │   └── lspconfig.lua
│   └── plugins
│       ├── alpha-nvim.lua
│       ├── indent-blankline.lua
│       ├── nvim-cmp.lua
│       ├── nvim-tree.lua
│       └── nvim-treesitter.lua
├── init.lua
└── lazy-lock.json

Note: Update the init.lua file with the instruction for load lazy configuration file:

-- init.lua 
-- Import Lua modules
  require('core/lazy')
  require('core/autocmds')
  require('core/keymaps')
  require('core/colors')
  require('core/statusline')
  require('core/options')
  require('lsp/lspconfig')
  require('plugins/nvim-tree')
  require('plugins/indent-blankline')
  require('plugins/nvim-cmp')
  require('plugins/nvim-treesitter')
  require('plugins/alpha-nvim')

New lazy.nvim files:

lazy-lock.json
/lua/core/lazy.lua

The lazy.lua is the configuration file, is very similar to packer_init.lua and makes it easy to migrate, see: https://github.com/folke/lazy.nvim#-migration-guide

The lazy-lock.json is automatically created when you run lazy.nvim for the first time, is the file with the git package information of the installed plugins, see: https://github.com/folke/lazy.nvim#-lockfile-lazy-lockjson

Installed plugins folder

The directory where the installed plugins are located will also change:

Old directory with packer:

${HOME}/.local/share/nvim/site/pack/packer/

New directory with lazy.nvim:

${HOME}/.local/share/nvim/lazy/

Advices

It is recommended to back up the current configuration with packer.nvim before doing the migration, in this way you have a fallback copy of a working Neovim configuration.

e.g.:

Backup of Neovim config and plugins directory with cp:

cp -Rv ${HOME}/.config/neovim /mybackups/neovim-backup_packer
cp -Rv ${HOME}/.local/share/nvim/site/pack/packer /mybackups/neovim-backup_packer/plugins

Backup with rsync:

rsync -ahv --progress ${HOME}/.config/neovim /mybackups/neovim-backup_packer
rsync -ahv --progress ${HOME}/.local/share/nvim/site/pack/packer /mybackups/neovim-backup_packer/plugins

Before using lazy.nvim you should read the information on how to do this, see: https://github.com/folke/lazy.nvim

For any questions and help you can comment on this section where I will try to help you with the migration (which is not difficult anyway). :)

@brainfucksec brainfucksec self-assigned this Feb 19, 2023
@brainfucksec brainfucksec added the breaking change Require manual intervention label Feb 19, 2023
@brainfucksec brainfucksec pinned this issue Feb 19, 2023
@PaideiaDilemma
Copy link

Cool :)
I have already migrated, but will adapt the suggested new layout with /lua/core/lazy.lua.

@brainfucksec brainfucksec added the important Important or critical changes label Feb 25, 2023
@brainfucksec
Copy link
Owner Author

Cool :) I have already migrated, but will adapt the suggested new layout with /lua/core/lazy.lua.

Thanks :)

@RainerKuemmerle
Copy link
Contributor

Use lazy update here: https://github.com/brainfucksec/neovim-lua/blob/main/nvim/lua/plugins/alpha-nvim.lua#L46

Thanks for providing the awesome template.

@tsrattan
Copy link

tsrattan commented Mar 1, 2023

Hi i migrate. Everything is running fine.
on statusline when I press : it still displays NORMAL instead of COMMAND.
Thanks

@brainfucksec
Copy link
Owner Author

Use lazy update here: https://github.com/brainfucksec/neovim-lua/blob/main/nvim/lua/plugins/alpha-nvim.lua#L46

Thanks for providing the awesome template.

Thanks, I have already updated the indicated command, thanks again for highlighting it :)

See: commit 8701098

@brainfucksec
Copy link
Owner Author

Hi i migrate. Everything is running fine. on statusline when I press : it still displays NORMAL instead of COMMAND. Thanks

Strange, I don't see error with : command:

2023-03-12_322x92

Please if you have problems on the statusline you should open a dedicated issue where I can follow up with you.

@brainfucksec brainfucksec unpinned this issue Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Require manual intervention important Important or critical changes
Projects
None yet
Development

No branches or pull requests

4 participants