folke / lazy.nvim

πŸ’€ A modern plugin manager for Neovim
https://lazy.folke.io/
Apache License 2.0
14.22k stars 345 forks source link

key lazyloading with which-key.nvim needs to be used twice #71

Closed max397574 closed 1 year ago

max397574 commented 1 year ago

Describe the bug I need to press <space>cc twice to actually make it work the first time it isn't mapped

Which version of Neovim are you using? NVIM v0.9.0-dev-525+ga7332ba9b

To Reproduce

Steps to reproduce the behavior:

  1. `nvim -u repro.lua repro.lua
  2. <space>cc
  3. <space>cc

Expected Behavior line gets commented out on 2.

Log Please include any related errors from the Noice log file. (open with :Lazy log)

Lazy log

   lazy.nvim (H)   Install (I)   Update (U)   Sync (S)   Clean (X)   Check (C)   Log (L)   Restore (R)   Profile (P)   Debug (D)   Help (?)  

  Total: 60 plugins

  Breaking Changes (1)
    ● lazy.nvim 18.74ms ο„‘  init.lua
        b7c489b fix(loader): lua modules can be links instead of files. Fixes #66 (55 minutes ago)
        7a57ea2 chore(build): auto-generate vimdoc (74 minutes ago)
        c228908 fix(health): don't show warning on `module=false` (75 minutes ago)
        b68f94b ci: Update issue templates (2 hours ago)
        bbebb67 ci: Update issue templates (2 hours ago)
        95fc814 chore(build): auto-generate vimdoc (2 hours ago)
        876f7bd feat(loader): allow to add extra paths to rtp reset. Fixes #64 (2 hours ago)
        a345649 fix(cache): if we can't load from the cache modpath, find path again instead of erroring right away (2 hours ago)
        bbace14 fix(git): only mark a plugin as dirty if an update changed the commit HEAD. Fixes #62 (3 hours ago)
        a939243 fix(checker): allow git checks only for non-pinned plugins (#61) (3 hours ago)
        57bea32 chore(build): auto-generate vimdoc (3 hours ago)
        ff24f49 fix(loader): source rtp `/plugin` files after loading start plugins. Fixes (3 hours ago)
        b802729 chore(build): auto-generate vimdoc (6 hours ago)
        9dfefac docs: fixed indentation of auto-generated code blocks (6 hours ago)
        71b2e2f docs: lazy works on all OSs now (6 hours ago)
        232232d fix(ui): install command can have plugins as a parameter (6 hours ago)
        4ca3039 feat(loader): warn when mapleader is changed after init (7 hours ago)
        540847b fix: strip `/` from dirs. Fixes #60 (7 hours ago)
        86eaa11 fix(git): dereference tag refs. Fixes #54 (7 hours ago)
        e95da35 feat(util): utility method to get sync process output (7 hours ago)
        3c3a711 chore(build): auto-generate vimdoc (8 hours ago)
        44f80a7 feat(plugin): allow plugin files only without a main plugin module. Fixes #53 (8 hours ago)
        f5734f5 chore(build): auto-generate vimdoc (9 hours ago)
        3814883 fix(ui): set current win only when its valid (9 hours ago)
        3a7b8c8 chore(main): release 5.1.0 (#30) (18 hours ago)
        3606d62 fix: add after directories to rtp to make after/ftplugin and others work. Fixes #47 (18 hours ago)
        b193f96 fix(spec): only process a spec once (18 hours ago)
        7be46bc style: removed unused requires (19 hours ago)
        897d6df fix: add filetype to window buffer. (#41) (20 hours ago)
        14300b3 chore(build): auto-generate vimdoc (20 hours ago)
        78e9d6c docs: add a note about mapleader (20 hours ago)
        06ac8bd perf(ui): clear existing extmarks before rendering (21 hours ago)
        ffcd0ab fix(loader): source filetype.lua before plugins. Fixes #35 (21 hours ago)
        9d12cdc fix(git): don't run git log for submodules. Fixes #33 (21 hours ago)
        06ffcf5 chore(build): auto-generate vimdoc (22 hours ago)
        7fb0652 docs: added docs on update checker (22 hours ago)
        1f86cb3 chore(build): auto-generate vimdoc (22 hours ago)
        3cffb2a docs: added change detection to the readme (22 hours ago)
        6c767a6 feat: added options to configure change detection. Fixes #32 (22 hours ago)
        cd162f3 chore(build): auto-generate vimdoc (22 hours ago)
        941df31 feat(ui): make the windoww size configurable. Fixes #34 (22 hours ago)
        5298441 fix: use nvim_feekeys instead of nvim_input for keys handler. Fixes #28 (23 hours ago)
        2927b05 docs: added lincense (23 hours ago)
        4d78203 chore(main): release 5.0.1 (#17) (24 hours ago)
        1371a14 fix(build): use the shell to execute build commands (24 hours ago)
        ffabe91 fix(cache): if mod is loaded already in the loader, then return that (25 hours ago)
        316503f fix: dont autoload cached modules when module=false (25 hours ago)
        992c679 fix: always set Config.me regardless of reset rtp (25 hours ago)
        df6c986 fix: add neovim libs to rtp for treesitter parsers etc (26 hours ago)
        49b69b7 chore(build): auto-generate vimdoc (27 hours ago)
        e9d3a73 fix: default logs are now since 3 days ago to be in line with the docs (27 hours ago)
        4234322 chore(build): auto-generate vimdoc (27 hours ago)
        6e32759 fix: deepcopy lazyspec before processing (27 hours ago)
        ec0f8d0 docs: added config.dev.path to the example (28 hours ago)
        6404d42 fix: move re-sourcing check to the top (28 hours ago)
        ddf36d7 fix: checker should not error on non-existing dirs (28 hours ago)
        50ba619 test: fix tests (28 hours ago)
        f78d8bf fix: show error when merging, but continue (28 hours ago)
        b8a0055 chore(build): auto-generate vimdoc (29 hours ago)
        1754056 fix: use jobstart instead of system to open urls (29 hours ago)
        5ecc988 docs: use https to bootstrap lazy (29 hours ago)
        ae644a6 fix: only run updated checker for installed plugins. Fixes #16 (29 hours ago)
        7225b05 chore(build): auto-generate vimdoc (30 hours ago)
        17fd57a docs: added docs for statusline and count (30 hours ago)
        48a596e chore(build): auto-generate vimdoc (30 hours ago)
        dfe8a65 docs: removed extra performance section (30 hours ago)
        1fa2d87 docs: moved my dots to structuring plugins (30 hours ago)
        9916318 chore(build): auto-generate vimdoc (30 hours ago)
        abe026a docs: added section on performance (30 hours ago)
        82aea47 chore(build): auto-generate vimdoc (31 hours ago)
        72d66cd docs: updated lua stuff (31 hours ago)
        ca43018 chore(build): auto-generate vimdoc (31 hours ago)
        36cb7ea docs: migration guide (31 hours ago)
        2f59ead chore(main): release 5.0.0 (#12) (31 hours ago)
        dbcf675 chore(build): auto-generate vimdoc (31 hours ago)
        b906ad9 docs: added windows to supported platforms (31 hours ago)
        cb87aa3 ci: run tests on linux only for nw (32 hours ago)
        75a36f3 chore(build): auto-generate vimdoc (33 hours ago)
        af87108 fix(util): fixed double slashes (33 hours ago)
        62c1542 fix(cache): normalize paths (33 hours ago)
        bb1c2f4 feat: added support for Windows (34 hours ago)
        198963f feat: utility method to normalize a path (34 hours ago)
        a189883 fix: check for installed plugins with plain find (34 hours ago)
        833b387 chore(build): auto-generate vimdoc (2 days ago)
        ff89319 docs: removed dots from features (2 days ago)
        b7bf18a style: spelling (2 days ago)
        66dad89 chore(build): auto-generate vimdoc (2 days ago)
        0c0b8b7 docs: todo (2 days ago)
        92fd0d4 docs: updated installation and structuring plugins (2 days ago)
        1baa92f docs: added docs on `` and `` (2 days ago)
        d827d8a docs: collapse semver examples (2 days ago)
        1e16363 chore(build): auto-generate vimdoc (2 days ago)
        980cfa9 docs: added config example when not using a Nerd Font (2 days ago)
        713dcb6 build: added markdownlint config (2 days ago)
        706fe6f chore(build): auto-generate vimdoc (2 days ago)
        5ed9855 feat: added completion for all lazy commands (2 days ago)
        b462787 docs: added optional plugins to docs for commands and methods (2 days ago)
        f29f3d2 chore(build): auto-generate vimdoc (2 days ago)
        1efa710 feat: added `module=false` to skip auto-loading of plugins on `require` (2 days ago)
        55d194c chore(build): auto-generate vimdoc (2 days ago)
        bac34cc docs: added section on uninstalling (2 days ago)
        c065ca2 chore(build): auto-generate vimdoc (2 days ago)
        2dd6230 feat: added `:Lazy load foobar.nvim` to load a plugin (2 days ago)
        8a0da3b config: move lazy cache to state/nvim/lazy/cache (2 days ago)
        7eb6034 chore(build): auto-generate vimdoc (2 days ago)
        6567580 chore: todo (2 days ago)
        6f00cde docs: typos (2 days ago)
        faac2dd perf(cache): cache loadfile and no find modpaths without package.loaders (2 days ago)
        32f2b71 fix(cache): do a fast check to see if a cached modpath is still valid. find it again otherwise (2 days ago)
        1fe43f3 fix(ui): focus Lazy window when auto-installing plugins in `VimEnter` (2 days ago)
        d4aee27 feat!: removed the LazyUpdate etc commands. sub-commands only from now on (2 days ago)
        b89e6bf perf: lazy-load the commands available on the `lazy` module (3 days ago)

  Log (10)
    β—‹ LuaSnip
        5570fd7 Auto generate docs (21 hours ago)
        618b945 log: don't print a message on every start, provide `log.ping()` instead. (21 hours ago)

    β—‹ formatter.nvim
        8a4c961 Add configuration for standardrb (#212) (31 minutes ago)
        31a0ee7 Fix lua-format args (#214) (31 minutes ago)
        9aaf855 feat: add support for PHP-CS-Fixer (#216) (32 minutes ago)
        c7d7d90 feat: add nix formatting support (#217) (33 minutes ago)
        369e35b Use `--stderr` flag for rubocop rather than parsing output (#210) (33 minutes ago)

    β—‹ gitsigns.nvim
        2ab3bdf fix(blame): #697 (2 days ago)

    β—‹ neodev.nvim
        c5f0a81 chore: auto-generated types for Neovim nightly (10 hours ago)
        f8b17d3 chore: auto-generated types for Neovim nightly (34 hours ago)

    ● noice.nvim 10.51ms ξͺ† VeryLazy
        585d24e fix(health): dont use nvim-treesitter to check if a lang exists (80 minutes ago)
        81269c5 ci: added .repro to .gitignore (2 hours ago)
        044767a fix: dont error in checkhealth if nvim-treesitter is not installed (2 hours ago)
        4e03e16 chore(main): release 1.5.0 (#269) (2 hours ago)
        d833d5e chore(build): auto-generate vimdoc (2 hours ago)
        aa68eb6 feat(format): allow `config.format.level.icons` to be false. Fixes #274 (2 hours ago)
        e4a4290 chore(build): auto-generate vimdoc (2 days ago)
        29a2e05 feat: added `Filter.cond` to conditionally use a route (2 days ago)

    ● nui.nvim 0.33ms ο’‡  noice.nvim
        b12db53 fix(layout): process split layout box change (11 hours ago)
        51721a4 fix(layout): process float layout box change (11 hours ago)
        96ef1cb feat(split): store id internally (11 hours ago)

    β—‹ nvim-dap
        284c754 Stop resizing widgets if converted to non-float window (2 days ago)
        3971d9b Allow opening multiple frames or scopes widgets (2 days ago)

    β—‹ nvim-lspconfig
        5292d60 docs: update server_configurations.md skip-checks: true (14 hours ago)
        f70a094 fix: rename ruff-lsp to ruff_lsp (#2337) (14 hours ago)
        80e81b1 docs: update server_configurations.md skip-checks: true (14 hours ago)
        d8a4493 chore: remove `languageFeatures`, `documentFeatures` (#2336) (14 hours ago)
        baab771 docs: update server_configurations.md skip-checks: true (15 hours ago)
        4e13145 feat: add ruff-lsp support (#2335) (15 hours ago)
        d597b0f fix: send the lsp method request after insert workspace folders (#2330) (34 hours ago)
        1ab2720 docs: update server_configurations.md skip-checks: true (34 hours ago)
        9c70f37 feat: add jq support (#2333) (34 hours ago)
        259729c docs: update server_configurations.md skip-checks: true (2 days ago)
        aa22008 feat: add uvl support (#2331) (2 days ago)
        dd9e7f9 fix(gdscript): support get the port from env variable (#2313) (2 days ago)
        22c87d6 build(rockspec): fix rockspec package name (2 days ago)

    ● nvim-treesitter 52.02ms ο’‡  nvim-treesitter-refactor
        770c66d Update parsers: v (4 hours ago)
        87dd482 fix(health): align the list of parsers when doing checkhealth (4 hours ago)
        ca09752 Update parsers: c_sharp, gdscript, sql (8 hours ago)
        eedb7b9 csharp: update query to parser change (33 hours ago)
        8498ebd Update parsers: c_sharp, jsonnet, query (33 hours ago)
        6e37050 Update parsers: swift (2 days ago)
        a75aded highlights(java): fix '!',param,global group (3 days ago)

    β—‹ telescope.nvim
        e960efa fix: jumplist picker indexing the line after (#2273) (5 hours ago)
        d16581e fix: misidentification invert and files_with_matches (#2240) (#2262) (8 hours ago)
        278c797 fix(builtin.live_grep): add spacer ":" even when coordinates disabled (#2275) (8 hours ago)

  Clean (11)
    β—‹ colorscheme_switcher
    β—‹ friendly-snippets
    β—‹ lense.nvim
    β—‹ neocomplete.nvim
    β—‹ neorg-context
    β—‹ neorg-kanban
    β—‹ neorg-telescope
    β—‹ neorg-zettelkasten
    β—‹ nvim-cmp
    β—‹ nvim-treehopper
    ● which-key.nvim 90.63ms ξ―‡  LazyLoad

  Loaded (6)
    ● heirline.nvim 5.26ms ξ«“ start
    ● nvim-notify 0.2ms ο’‡  noice.nvim
    ● nvim-treesitter-endwise 1.76ms ο’‡  nvim-treesitter
    ● nvim-treesitter-refactor 57.96ms ξ―‡  LazyLoad
    ● nvim-treesitter-textobjects 21.98ms ο’‡  nvim-treesitter
    ● playground 1.67ms ο’‡  nvim-treesitter

  Installed (32)
    β—‹ Comment.nvim
    β—‹ bufferline.nvim
    β—‹ cmp-emoji
    β—‹ cmp-latex-symbols
    β—‹ cmp-nvim-lsp
    β—‹ cmp-nvim-lua
    β—‹ cmp-path
    β—‹ cmp_luasnip
    β—‹ dirbuf.nvim
    β—‹ gitlinker.nvim
    β—‹ indent-blankline.nvim
    β—‹ jeskape.nvim
    β—‹ lightspeed.nvim
    β—‹ luv-vimdocs
    β—‹ nabla.nvim
    β—‹ neogen
    β—‹ neorg
    β—‹ nvim-autopairs
    β—‹ nvim-colorizer.lua
    β—‹ nvim-dap-ui
    β—‹ nvim-dap-virtual-text
    β—‹ nvim-surround
    β—‹ nvim-web-devicons
    β—‹ one-small-step-for-vimkind
    β—‹ paperplanes.nvim
    β—‹ plenary.nvim
    β—‹ rust-tools.nvim
    β—‹ ssr.nvim
    β—‹ telescope-file-browser.nvim
    β—‹ telescope-fzf-native.nvim
    β—‹ toggleterm.nvim
    β—‹ trouble.nvim
repro.lua ```lua local root = vim.fn.fnamemodify("./.repro", ":p") -- set stdpaths to use .repro for _, name in ipairs({ "config", "data", "state", "cache" }) do vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name end vim.g.mapleader = " " -- bootstrap lazy local lazypath = root .. "/plugins/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "--single-branch", "https://github.com/folke/lazy.nvim.git", lazypath, }) end vim.opt.runtimepath:prepend(lazypath) -- install plugins local plugins = { "folke/tokyonight.nvim", { "folke/which-key.nvim", config = function() require("which-key").register({ c = { name = " Comment", c = { "Toggle Line" }, }, }, { prefix = "", mode = "n", }) end, }, { "numToStr/Comment.nvim", keys = { "c", "gb" }, config = function() require("comment").setup({ toggler = { ---line-comment keymap line = "cc", ---block-comment keymap block = "gbc", }, ---LHS of operator-pending mappings in NORMAL + VISUAL mode opleader = { ---line-comment keymap line = "c", ---block-comment keymap block = "gb", }, mappings = { -- extended = true, }, }) end, }, -- add any other pugins here } require("lazy").setup(plugins, { root = root .. "/plugins", }) -- add anything else here vim.opt.termguicolors = true vim.cmd.colorscheme("tokyonight") ```

two other things:

  1. add the repro.lua fold thing like I did to this issue template
  2. perhaps rethink the root in repro. because people don't expect the plugins to be cloned into their current directory (at least I didn't)
oblitum commented 1 year ago

28 is related, have you checked it, or updated the plugin?

max397574 commented 1 year ago

yes and yes

folke commented 1 year ago

You didn't add <leader>cc to the keys handler. Adding that one makes it work

max397574 commented 1 year ago

reopening the issue <leader>cj @folke

folke commented 1 year ago

What do you mean?

max397574 commented 1 year ago

<leader>cj doesn't work

folke commented 1 year ago

which is also not in that keys handler?

max397574 commented 1 year ago

yes it isn't because it's an operator pending mapping and I can't put all the different text objects and motions into the keys handler

folke commented 1 year ago

I get what you mean with that leader cj now. leader c is an operator pending mode. Keys currently only supports normal mode, so the retrigger will not to what you want.

max397574 commented 1 year ago

weird thing I just discovered if I press <leader>c, wait a lil bit and then j it works

folke commented 1 year ago

I'm planning on expanding the keys handler soon.

That works, because that will load the comments plugin. Your then inside whichkey and pressing c again, wich-key will redo the whole mapping, so that works

max397574 commented 1 year ago

I'll wait for that expansion then and until then try to hack something together with init

folke commented 1 year ago

I think I was able to fix it anyway. At least it also works now for <leader>cj

max397574 commented 1 year ago

works perfectly now thank you very much for the quick fix