Skip to content

Commit

Permalink
refactor!: replace packer.nvim plugin manager with lazy.nvim
Browse files Browse the repository at this point in the history
[packer.nvim](https://github.com/wbthomason/packer.nvim)
has some anti-features and bugs that were a deal breaker for me:

- Bootstrapping is not straightforward
- Snapshots are fundamentally broken, i.e.
if I removed a plugin I tried to restore a snapshot packer would not work.
- Luarocks install doesn't work on macos
- Packer compilation step is annoying and sometimes makes config files out of sync
with the current setup, which makes debugging and plugin development awkward

[lazy.nvim](https://github.com/folke/lazy.nvim) doesn't have a compilation step,
doesn't require [impatient.nvim](https://github.com/lewis6991/impatient.nvim) for speeding up
modules initialization, has a straightforward bootstrap process and in general has a better design than
[packer.nvim](https://github.com/wbthomason/packer.nvim).

SEE: wbthomason/packer.nvim#814
SEE: wbthomason/packer.nvim#1010
SEE: wbthomason/packer.nvim#180
  • Loading branch information
jvcarli committed Jan 2, 2023
1 parent d848e31 commit 2f87215
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 23 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# packer generated compiled file
lua/packer/packer_compiled.lua

# neovim profiling
profile.log

Expand Down
2 changes: 0 additions & 2 deletions .styluaignore

This file was deleted.

3 changes: 0 additions & 3 deletions .vim.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ name = "vim"
[vim]
any = true

[packer_plugins]
any = true

# P global from user.modules.globals
[P]
any = true
Expand Down
7 changes: 5 additions & 2 deletions _vscode/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ else
end

-- DO NOT use default packpath "~/.local/share/nvim/site/*"
-- because packer.nvim plugin manager uses it and Vscode would load undeseried plugins.
vim.cmd "set packpath="
-- because some plugin managers use this path and Vscode would load undesired plugins.
vim.opt.packpath = { "~/.local/share/vscode-neovim/site" }

-- Plugins and its settings.
require "plugins"

-- Lua modules
require "keymaps"
3 changes: 1 addition & 2 deletions after/ftplugin/python.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- TODO: make dual colorcolumn for python work
-- {{{ Colorcolumn
-- PEP8: https://www.python.org/dev/peps/pep-0008/#id17
-- Black Formatter: https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
-- PEP8 (<80 colorcolumn limit), Black default (<89 colorcolumn limit)

-- TODO: don't be lazy, make logic indepotent from lspconfig
-- if packer_plugins["nvim-lspconfig"] and packer_plugins["nvim-lspconfig"].loaded then
-- local lspconfig = require "lspconfig"
-- local search_ancestors = lspconfig.util.search_ancestors
-- local is_file = lspconfig.util.path.is_file
Expand All @@ -27,7 +27,6 @@
-- end
--
-- setlocal_py_colorcolumn(current_path)
-- end

-- }}}

Expand Down
141 changes: 141 additions & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"Comment.nvim": { "branch": "master", "commit": "7bb563ff2d811a63b207e9de63e3e9c0877cb6d5" },
"FastFold": { "branch": "master", "commit": "542683b0cce738be22b6fdadb08302faed68e7b4" },
"LuaSnip": { "branch": "master", "commit": "5570fd797eae0790affb54ea669a150cad76db5d" },
"NrrwRgn": { "branch": "master", "commit": "e027db9d94f94947153cd7b5ac9abd04371ab2b0" },
"SchemaStore.nvim": { "branch": "main", "commit": "99cdee23ff1343da67c37b4dffb0821a8fdf82a6" },
"YankAssassin.vim": { "branch": "main", "commit": "55ce478a08333c086bcccdf087453085f85854d4" },
"any-jump.vim": { "branch": "master", "commit": "9768403b6381ce3758cebac9613910c0160969e3" },
"aw-watcher-vim": { "branch": "master", "commit": "3df3aa78dc10ebb655df652ee1464b27d001f6a2" },
"catppuccin": { "branch": "main", "commit": "3020af75aae098a77737d91ee37c7147c8450d99" },
"clever-f.vim": { "branch": "master", "commit": "6a3ac5e3688598af9411ab741737f98c47370c22" },
"cmdbuf.nvim": { "branch": "main", "commit": "4e01937d691eca02af9a8ab2930b1b96eb055065" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" },
"cmp-git": { "branch": "main", "commit": "fae6cdb407ad6c63a0b1928670bad1a67a55b887" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "d2768cb1b83de649d57d967085fe73c5e01f8fd7" },
"cmp-nvim-lua": { "branch": "main", "commit": "d276254e7198ab7d00f117e88e223b4bd8c02d21" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-rg": { "branch": "master", "commit": "1cad8eb315643d0df13c37401c03d7986f891011" },
"cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"dial.nvim": { "branch": "master", "commit": "61afb28f61ba090a67a88186f7bc8a94212e509a" },
"diffview.nvim": { "branch": "main", "commit": "18f83302f71889b39403919b8be00d7244d1fcfc" },
"duck.nvim": { "branch": "main", "commit": "b1a3b4e52eec886bf4ce5ed692a2162d504d9632" },
"git-messenger.vim": { "branch": "master", "commit": "8a61bdfa351d4df9a9118ee1d3f45edbed617072" },
"git-worktree.nvim": { "branch": "master", "commit": "d7f4e2584e81670154f07ca9fa5dd791d9c1b458" },
"gitsigns.nvim": { "branch": "main", "commit": "2ab3bdf0a40bab53033048c6be75bda86316b55d" },
"gruvbox.nvim": { "branch": "main", "commit": "c64ec557672c9c8ecc71a438533525482021377f" },
"gv.vim": { "branch": "master", "commit": "320cc8c477c5acc4fa0e52a460d87b2af54fa051" },
"harpoon": { "branch": "master", "commit": "21d0d1bfa3000e4384740bfaefa0ebc51c773786" },
"kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" },
"lazy.nvim": { "branch": "main", "commit": "85173dcc4d7a39e67370571316a6290f31a0de4a" },
"leap-spooky.nvim": { "branch": "main", "commit": "748b2614e859704d8004e86be97401c9f3e28e80" },
"leap.nvim": { "branch": "main", "commit": "e0145906c5f004b23eb6ec876fad55ffd3382ec9" },
"linediff.vim": { "branch": "main", "commit": "b4d3c3f03eed00caa741c2650e13db5b7b7ce0ef" },
"lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
"lualine.nvim": { "branch": "master", "commit": "32a7382a75a52e8ad05f4cec7eeb8bbfbe80d461" },
"lush.nvim": { "branch": "main", "commit": "4cc81a12731fbefce1582a940b755691eb3eb6d1" },
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
"mini.nvim": { "branch": "main", "commit": "41b1d7c4cc45d6043bb3fcff4082db532b35e275" },
"neodev.nvim": { "branch": "main", "commit": "c045c0fe93b1f9c78443d0f3b88660fffbcf64a7" },
"neogen": { "branch": "main", "commit": "96e5d013bfe52ac41f69343e515e1730ed6661de" },
"no-clown-fiesta.nvim": { "branch": "master", "commit": "a7de377d8d3087581958f84d982b616fc93ca471" },
"null-ls.nvim": { "branch": "main", "commit": "d09d7d82cc26d63673cef85cb62895dd68aab6d8" },
"nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" },
"nvim-cmp": { "branch": "main", "commit": "c49ad26e894e137e401b1d294948c46327877eaf" },
"nvim-dap": { "branch": "master", "commit": "69b7c684cd42e60b48875c580e616a70bccfdbe7" },
"nvim-lsp-ts-utils": { "branch": "main", "commit": "0a6a16ef292c9b61eac6dad00d52666c7f84b0e7" },
"nvim-lspconfig": { "branch": "master", "commit": "6b43ce561d97412cc512b569db6938e44529293e" },
"nvim-neoclip.lua": { "branch": "main", "commit": "db50498b0e07c1fb2e5b9894e512d7b333a8bb76" },
"nvim-tree.lua": { "branch": "master", "commit": "951b6e7e55da8aee9566cc0b17c11f9451cec349" },
"nvim-treesitter": { "branch": "master", "commit": "12e95e160d7d45b76a36bca6303dd8447ab77490" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "0cf4601c330cf724769a2394df555a57d5fd3f34" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "75f5895cc662d61eb919da8050b7a0124400d589" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "d816761ec1ea4a605689bc5f4111088459cf74d4" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "bc047b20768845fd54340eb76272b2cf2f6fa3f3" },
"nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "4a42b30376c1bd625ab5016c2079631d531d797a" },
"nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" },
"nvim-ufo": { "branch": "main", "commit": "4d10f5fe4ac42c2e23b914ab21db9cce7b5e534e" },
"nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" },
"onedark.nvim": { "branch": "master", "commit": "89dde4963ad198c9b6144dee3d5e8bcbb7559ddc" },
"open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" },
"plantuml-syntax": { "branch": "master", "commit": "845abb56dcd3f12afa6eb47684ef5ba3055802b8" },
"playground": { "branch": "master", "commit": "8a887bcf66017bd775a0fb19c9d8b7a4d6759c48" },
"plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" },
"promise-async": { "branch": "main", "commit": "25ac2ddb577bbc1bda2402e6dd6bd33d52cec398" },
"quickfix-reflector.vim": { "branch": "master", "commit": "6a6a9e28e1713b9e9db99eec1e6672e5666c01b9" },
"refactoring.nvim": { "branch": "master", "commit": "2c72385b627e46bb66f23b8a11da40b4bb127506" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"splitjoin.vim": { "branch": "main", "commit": "956d67c88512b91c2938da3a9e0aeeea2b82cd0b" },
"sqlite.lua": { "branch": "master", "commit": "53cac3fdb5f5e4e63e243232b6eccf3c764ae18a" },
"tabman.vim": { "branch": "master", "commit": "8f2ca9268a2ec1bcb29231b5b3f872101d169901" },
"taboo.vim": { "branch": "master", "commit": "caf948187694d3f1374913d36f947b3f9fa1c22f" },
"targets.vim": { "branch": "master", "commit": "8d6ff2984cdfaebe5b7a6eee8f226a6dd1226f2d" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "fab3e2212e206f4f8b3bbaa656e129443c9b802e" },
"telescope-project.nvim": { "branch": "master", "commit": "8e8ee37b7210761502cdf2c3a82b5ba8fb5b2972" },
"telescope.nvim": { "branch": "master", "commit": "a606bd10c79ec5989c76c49cc6f736e88b63f0da" },
"todo-comments.nvim": { "branch": "main", "commit": "c1760010f46992165995aaa52ca967f473a2e8e6" },
"trouble.nvim": { "branch": "main", "commit": "897542f90050c3230856bc6e45de58b94c700bbf" },
"twilight.nvim": { "branch": "main", "commit": "1ffa6a4d89fb2fbb784c6674044bf54f1fca936f" },
"undotree": { "branch": "master", "commit": "1a23ea84bd02c34f50d8e10a8b4bfc89597ffe4e" },
"vim-EnhancedJumps": { "branch": "master", "commit": "84df0d73f732bfb926763f5b0469a47dd63289a1" },
"vim-ReplaceWithRegister": { "branch": "master", "commit": "aad1e8fa31cb4722f20fe40679caa56e25120032" },
"vim-UnconditionalPaste": { "branch": "master", "commit": "e5c5a56cba2fe57675cb64301da1963b056c892e" },
"vim-apathy": { "branch": "master", "commit": "27128a0f55189724c841843ba41cd33cf7186032" },
"vim-bookmarks": { "branch": "master", "commit": "9cc5fa7ecc23b052bd524d07c85356c64b92aeef" },
"vim-caser": { "branch": "master", "commit": "6bc9f41d170711c58e0157d882a5fe8c30f34bf6" },
"vim-characterize": { "branch": "master", "commit": "1ba0fcf208464647e2df2e9f693247a2207f22a4" },
"vim-cool": { "branch": "master", "commit": "80c19445728d70595c2f72d0436527e28292ebd9" },
"vim-cppman": { "branch": "master", "commit": "de1318252b68fba9b8249254475b6e050d160b73" },
"vim-dirvinist": { "branch": "master", "commit": "d022c53f5b4cd72042526bf038d8cba4d9c2f474" },
"vim-dirvish": { "branch": "master", "commit": "6233243f0caa71d27d27ea102540a88bce8eb6ea" },
"vim-dispatch": { "branch": "master", "commit": "00e77d90452e3c710014b26dc61ea919bc895e92" },
"vim-dispatch-neovim": { "branch": "master", "commit": "c8c4e21a95c25032a041002f9bf6e45a75a73021" },
"vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" },
"vim-enfocado": { "branch": "main", "commit": "d19984a8ad4caa3d3b29cee1f959fcb772b2a573" },
"vim-eunuch": { "branch": "master", "commit": "291ef1f8c8996ca7715df1032a35a27b12d7b5cf" },
"vim-exchange": { "branch": "master", "commit": "784d63083ad7d613aa96f00021cd0dfb126a781a" },
"vim-fugitive": { "branch": "master", "commit": "99cdb88bc64063dc4656ae53496f06fb2a394cd4" },
"vim-go": { "branch": "master", "commit": "9b6c5a66a1305179e9b130a8074d05973ea57315" },
"vim-gtfo": { "branch": "master", "commit": "c5fb3560222da71d96b8d4d792ba1d46466044da" },
"vim-gutentags": { "branch": "master", "commit": "1337b1891b9d98d6f4881982f27aa22b02c80084" },
"vim-illuminate": { "branch": "master", "commit": "a6d0b28ea7d6b9d139374be1f94a16bd120fcda3" },
"vim-indent-object": { "branch": "master", "commit": "5c5b24c959478929b54a9e831a8e2e651a465965" },
"vim-ingo-library": { "branch": "master", "commit": "097b1c729ee0f334a40eddfbd84d77161287f2f1" },
"vim-kitty": { "branch": "main", "commit": "d4c60f096b751c1462c80cbf42550e29c8cd2983" },
"vim-lastplace": { "branch": "master", "commit": "cef9d62165cd26c3c2b881528a5290a84347059e" },
"vim-log-highlighting": { "branch": "master", "commit": "1037e26f3120e6a6a2c0c33b14a84336dee2a78f" },
"vim-moonfly-colors": { "branch": "master", "commit": "5fc39cbc04de7395db942758a546c7f87bfcb571" },
"vim-move": { "branch": "master", "commit": "a4bbedda7ef516b4a1b74d145cd642297e82e800" },
"vim-niceblock": { "branch": "master", "commit": "9302f527eefc0fde8df983cbb9710ad52c4213b5" },
"vim-ninja-feet": { "branch": "master", "commit": "cb9b448dd468a338255aed474e6113ed115612c1" },
"vim-operator-user": { "branch": "master", "commit": "c3dfd41c1ed516b4b901c97562e644de62c367aa" },
"vim-projectionist": { "branch": "master", "commit": "558013b66ba8f30e75fd67a67374662fd6961eb8" },
"vim-qf": { "branch": "master", "commit": "65f115c350934517382ae45198a74232a9069c2a" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-rfc": { "branch": "master", "commit": "5a7dfe4bc02fd0b10beb0026effde5c40d2ca648" },
"vim-rhubarb": { "branch": "master", "commit": "cad60fe382f3f501bbb28e113dfe8c0de6e77c75" },
"vim-rsi": { "branch": "master", "commit": "4c673fb6c70652a09682c50a0e308184731ca70b" },
"vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" },
"vim-searchindex": { "branch": "master", "commit": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648" },
"vim-sleuth": { "branch": "master", "commit": "8332f123a63c739c870c96907d987cc3ff719d24" },
"vim-slime": { "branch": "main", "commit": "c9eaebd1068443b4d92c952788e4c75d337c1125" },
"vim-startuptime": { "branch": "master", "commit": "cb4c112b9e0f224236ee4eab6bf5153406b3f88b" },
"vim-tbone": { "branch": "master", "commit": "82b0118772a87b659a6af49b26b0c4817ec7eccf" },
"vim-test": { "branch": "master", "commit": "c6e5d249241342fd4592a67113cb539427d57e23" },
"vim-tmux-navigator": { "branch": "master", "commit": "18f0c7fc1e7181e6422247505727d7111c5da544" },
"vim-translator": { "branch": "master", "commit": "63ac44f87563fea49cfb5f07379b5959ef19cdaa" },
"vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" },
"vim-visual-multi": { "branch": "master", "commit": "724bd53adfbaf32e129b001658b45d4c5c29ca1a" },
"vim-visual-star-search": { "branch": "master", "commit": "7c32edb9e3c85d473d9be4dec721a4c9d5d4d69c" },
"vim-wordmotion": { "branch": "master", "commit": "5dd613ed68a0ecf0fc6c11cd4098c03583786bf0" },
"vimtex": { "branch": "master", "commit": "5e03d9052de30c8e4c2f4907600783112454028a" },
"which-key.nvim": { "branch": "main", "commit": "8682d3003595017cd8ffb4c860a07576647cc6f8" },
"zen-mode.nvim": { "branch": "main", "commit": "6f5702db4fd4a4c9a212f8de3b7b982f3d93b03c" },
"zenbones.nvim": { "branch": "main", "commit": "9d865e070ada2b81a92ba8b3bf564b3fc71efc53" },
"zinit-vim-syntax": { "branch": "main", "commit": "50bb044056c5cc55549cd3057e7a16ed713214eb" },
"zoxide.vim": { "branch": "master", "commit": "7add42b0474b07c206c94d1693997e52d25c5fec" }
}
1 change: 0 additions & 1 deletion lua/plugins/settings/indent_blankline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ require("indent_blankline").setup {

filetype_exclude = {
"help",
"packer",
"startify",
"man",
"gitmessengerpopup",
Expand Down
4 changes: 2 additions & 2 deletions lua/plugins/settings/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ for _, server in ipairs(servers) do
path = lua_runtime_path,
},
diagnostics = {
-- Get the language server to recognize `vim` and `packer_plugins` globals
globals = { "vim", "packer_plugins" },
-- Get the language server to recognize `vim` globals
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
Expand Down
8 changes: 0 additions & 8 deletions lua/user/modules/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ M.executable = function(cmdline_tool)
end
end

M.installed_and_loaded = function(plugin)
if M.file_exists(vim.fn.getenv "HOME" .. "/.config/nvim/lua/packer/packer_compiled.lua") then
return packer_plugins[plugin] and packer_plugins[plugin].loaded
else
return false
end
end

M.file_exists = function(...)
-- SEE: https://stackoverflow.com/questions/7573588/variable-number-of-function-arguments-lua-5-1
local files_to_check = { ... }
Expand Down

0 comments on commit 2f87215

Please sign in to comment.