From 22476d08ae70f91bfd5fed6cead99f5a7b8e011d Mon Sep 17 00:00:00 2001 From: sefidel Date: Sun, 1 Oct 2023 20:43:55 +0900 Subject: feat(pack)!: use lazy.nvim This commit replaces packer.nvim with lazy.nvim to make the lazy-load based package management painless, with lazy.nvim's automatic module lazy-loading and lockfile support. Squashed commit of the following: commit 4b972111b3f91f0b385a6d58640c7751ff8ecd22 Author: sefidel Date: Sun Oct 1 20:43:42 2023 +0900 wip: remove leftover mentions to packer.nvim commit 536106e405b9ec20084b9735a937e80699cdcbb8 Author: sefidel Date: Sun Oct 1 20:33:44 2023 +0900 wip: get rid of luarocks macros commit 6cf35948e4a3081446a9c9414bf350661444df72 Author: sefidel Date: Sun Oct 1 20:18:51 2023 +0900 wip: working lazy.nvim checkpoint commit 407056efd6de976b4d91162c70e3b49cca17664e Author: sefidel Date: Sun Oct 1 13:38:43 2023 +0900 wip: replace packer.nvim with lazy.nvim --- README.md | 2 +- fnl/nvrc/macro/pack.fnl | 43 +++++++------------------------------------ fnl/nvrc/pack.fnl | 30 +++++++++++++++--------------- init.lua | 10 +++++++--- lazy-lock.json | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 55 deletions(-) create mode 100644 lazy-lock.json diff --git a/README.md b/README.md index 74463c5..e9f66db 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ upstream. # Shoutouts - [rktjmp/hotpot.nvim](https://github.com/rktjmp/hotpot.nvim) -- [wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim) +- [folke/lazy.nvim](https://github.com/folke/lazy.nvim) - [shaunsingh/nyoom.nvim](https://github.com/shaunsingh/nyoom.nvim) - [kolja/vimrc](https://github.com/kolja/vimrc) - [Olical/aniseed](https://github.com/Olical/aniseed) diff --git a/fnl/nvrc/macro/pack.fnl b/fnl/nvrc/macro/pack.fnl index 7f76a0d..074723e 100644 --- a/fnl/nvrc/macro/pack.fnl +++ b/fnl/nvrc/macro/pack.fnl @@ -7,16 +7,14 @@ (fn tbl? [x] (= :table (type x))) -(local {: format} string) (local {: insert} table) (global nvrc/pack []) -(global nvrc/rock []) (lambda pack [identifier ?options] "Returns a mixed table with the identifier as the first sequential element and options as hash-table items. - See https://github.com/wbthomason/packer.nvim for information about the + See https://github.com/folke/lazy.nvim for information about the options." (assert-compile (str? identifier) "expected string for identifier" identifier) (assert-compile (or (nil? ?options) (tbl? ?options)) @@ -24,8 +22,8 @@ (let [options (or ?options {}) options (collect [k v (pairs options)] (if - (= k :req) (values :config (format "require('nvrc.packs.%s')" v)) - (= k :init) (values :config (format "require('%s').setup({})" v)) + (= k :req) (values :config `#(require (string.format "nvrc.packs.%s" ,v))) + (= k :init) (values :config `#((. (require ,v) :setup) {})) (values k v)))] (doto options (tset 1 identifier)))) @@ -33,47 +31,20 @@ (lambda pack! [identifier ?options] "Declares a plugin with its options. This is a mixed table saved on the global compile-time variable nvrc/pack. - See https://github.com/wbthomason/packer.nvim for information about the + See https://github.com/folke/lazy.nvim for information about the options." (assert-compile (str? identifier) "expected string for identifier" identifier) (assert-compile (or (nil? ?options) (tbl? ?options)) "expected table for options" ?options) (insert nvrc/pack (pack identifier ?options))) -(lambda rock [identifier ?options] - "Returns a mixed table with the identifier as the first sequential element - and options as hash-table items. - See https://github.com/wbthomason/packer.nvim for information about the - options." - (assert-compile (str? identifier) "expected string for identifier" identifier) - (assert-compile (or (nil? ?options) (tbl? ?options)) - "expected table for options" ?options) - (let [options (or ?options {})] - (doto options - (tset 1 identifier)))) - -(lambda rock! [identifier ?options] - "Declares a plugin with its options. - This is a mixed table saved on the global compile-time variable nvrc/rock. - See https://github.com/wbthomason/packer.nvim for information about the - options." - (assert-compile (str? identifier) "expected string for identifier" identifier) - (assert-compile (or (nil? ?options) (tbl? ?options)) - "expected table for options" ?options) - (insert nvrc/rock (rock identifier ?options))) - (lambda unpack! [] "Initializes the plugin manager with the previously declared plugins and their options." - (let [packs (icollect [_ v (ipairs nvrc/pack)] - `(use ,v)) - rocks (icollect [_ v (ipairs nvrc/rock)] - `(use_rocks ,v))] - `((. (require :packer) :startup) #(do - ,(unpack (icollect [_ v (ipairs packs) :into rocks] v)))))) + (let [packs [(unpack (icollect [_ v (ipairs nvrc/pack)] + v))]] + `((. (require :lazy) :setup) ,packs))) {: pack : pack! - : rock - : rock! : unpack!} diff --git a/fnl/nvrc/pack.fnl b/fnl/nvrc/pack.fnl index f0c2104..15481b3 100644 --- a/fnl/nvrc/pack.fnl +++ b/fnl/nvrc/pack.fnl @@ -1,26 +1,24 @@ (import-macros {: pack : pack! : unpack!} :nvrc.macro.pack) (import-macros {: setv!} :nvrc.macro.set) -(pack! :wbthomason/packer.nvim) +(pack! :folke/lazy.nvim) (pack! :rktjmp/hotpot.nvim) -(pack! :nanotech/jellybeans.vim {:config "require('nvrc.colors').apply('jellybeans')"}) +(pack! :nanotech/jellybeans.vim {:config #((. (require :nvrc.colors) :apply) :jellybeans)}) (pack! :kvrohit/rasmus.nvim) (pack! :nvim-treesitter/nvim-treesitter {:req :treesitter - :requires [(pack :nvim-treesitter/nvim-treesitter-refactor {:after :nvim-treesitter}) - (pack :nvim-treesitter/nvim-treesitter-textobjects {:after :nvim-treesitter})]}) + :dependencies [(pack :nvim-treesitter/nvim-treesitter-refactor) + (pack :nvim-treesitter/nvim-treesitter-textobjects)]}) (pack! :antoinemadec/FixCursorHold.nvim) (pack! :justinmk/vim-dirvish) (pack! :neovim/nvim-lspconfig {:req :lspconfig - :requires [(pack :hrsh7th/cmp-nvim-lsp {:after :nvim-cmp}) - (pack :j-hui/fidget.nvim {:req :fidget :after :nvim-lspconfig :branch :legacy}) ; FIXME: Compatibility during rewrite - (pack :hrsh7th/cmp-nvim-lsp-signature-help {:after :cmp-nvim-lsp})]}) -(pack! :simrat39/rust-tools.nvim {:req :rust :ft :rust :requires [(pack :nvim-lua/plenary.nvim)]}) -(pack! :p00f/clangd_extensions.nvim {:req :clangd :ft [:c :cpp :objc :objcpp] :module :clangd_extensions}) -(pack! :mfussenegger/nvim-dap {:req :dap :requires [(pack :nvim-lua/plenary.nvim)]}) -(pack! :rcarriga/nvim-dap-ui {:init :dapui :requires [(pack :mfussenegger/nvim-dap)]}) + :dependencies [(pack :j-hui/fidget.nvim {:req :fidget :branch :legacy})]}) +(pack! :simrat39/rust-tools.nvim {:req :rust :ft :rust :dependencies [(pack :nvim-lua/plenary.nvim)]}) +(pack! :p00f/clangd_extensions.nvim {:req :clangd :ft [:c :cpp :objc :objcpp]}) +(pack! :mfussenegger/nvim-dap {:req :dap :dependencies [(pack :nvim-lua/plenary.nvim) + (pack :rcarriga/nvim-dap-ui {:init :dapui})]}) (pack! :gpanders/editorconfig.nvim) (pack! :stefandtw/quickfix-reflector.vim {:ft :qf}) (pack! :tpope/vim-fugitive) @@ -28,10 +26,12 @@ (pack! :tpope/vim-sleuth) (pack! :hrsh7th/nvim-cmp {:req :cmp :event :BufEnter - :requires [(pack :L3MON4D3/LuaSnip {:module :luasnip}) - (pack :lukas-reineke/cmp-under-comparator {:module :cmp-under-comparator})]}) -(pack! :numToStr/Comment.nvim {:module :Comment :init :Comment}) -(pack! :ibhagwan/fzf-lua {:req :fzf :module :fzf-lua}) + :dependencies [(pack :L3MON4D3/LuaSnip) + (pack :lukas-reineke/cmp-under-comparator) + (pack :hrsh7th/cmp-nvim-lsp {:after :nvim-cmp}) + (pack :hrsh7th/cmp-nvim-lsp-signature-help)]}) +(pack! :numToStr/Comment.nvim {:init :Comment}) +(pack! :ibhagwan/fzf-lua {:req :fzf}) (pack! :ggandor/leap.nvim {:req :leap}) (pack! :windwp/nvim-autopairs {:req :autopairs}) diff --git a/init.lua b/init.lua index 3e8e14b..82565b8 100644 --- a/init.lua +++ b/init.lua @@ -4,18 +4,22 @@ local run = vim.api.nvim_command -- Enable opt-in filetype.lua: https://github.com/neovim/neovim/pull/16600 vim.g.do_filetype_lua = 1 +local ensure_paths = {} + local function ensure(user, repo) - local install_path = fmt("%s/site/pack/packer/start/%s", vim.fn.stdpath("data"), repo) + local install_path = fmt("%s/lazy/%s", vim.fn.stdpath("data"), repo) + table.insert(ensure_paths, install_path) if vim.fn.empty(vim.fn.glob(install_path)) ~= 0 then print(fmt("Pack '%s' not found, cloning to %s", repo, install_path)) run(fmt("!git clone https://github.com/%s/%s %s", user, repo, install_path)) - run(fmt("packadd %s", repo)) end end -ensure("wbthomason", "packer.nvim") +ensure("folke", "lazy.nvim") ensure("rktjmp", "hotpot.nvim") +vim.opt.rtp:prepend(ensure_paths) + require("hotpot").setup { provide_require_fennel = true } require("nvrc.ignite") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..e6f0366 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,32 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" }, + "clangd_extensions.nvim": { "branch": "main", "commit": "bafed83f79b5779f5b43e8e015e13ca99dcd8b3a" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, + "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, + "editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" }, + "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, + "fzf-lua": { "branch": "main", "commit": "f4091b9fa05ae6c2eab2823c0b345be2a27208c6" }, + "hotpot.nvim": { "branch": "master", "commit": "1dc11eb47ca15828df8ed3c7a014eeca9c564e55" }, + "jellybeans.vim": { "branch": "master", "commit": "ef83bf4dc8b3eacffc97bf5c96ab2581b415c9fa" }, + "lazy.nvim": { "branch": "main", "commit": "59335c5b9d116f5d3948f833288a89e2a829a005" }, + "leap.nvim": { "branch": "main", "commit": "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c" }, + "nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-dap": { "branch": "master", "commit": "b3d4408e29d924fe130c9397a7c3b3630b3ea671" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-lspconfig": { "branch": "master", "commit": "7ec2ab0cb8f529708dba55964fb0a59d3cc21853" }, + "nvim-treesitter": { "branch": "master", "commit": "776e4d341b5416c995e74c3abbf75f9cec26aa5e" }, + "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "quickfix-reflector.vim": { "branch": "master", "commit": "6a6a9e28e1713b9e9db99eec1e6672e5666c01b9" }, + "rasmus.nvim": { "branch": "main", "commit": "f824de95d446686e479781c0c2b778c177da528f" }, + "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, + "vim-dirvish": { "branch": "master", "commit": "bbf53b30ca1e718625b9b84b1d32379e470ddad7" }, + "vim-eunuch": { "branch": "master", "commit": "67f3dd32b4dcd1c427085f42ff5f29c7adc645c6" }, + "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" } +} \ No newline at end of file -- cgit 1.4.1