folke / lazy.nvim

💤 A modern plugin manager for Neovim
https://lazy.folke.io/
Apache License 2.0
14.07k stars 336 forks source link

weird bug with key lazy loading #128

Closed max397574 closed 1 year ago

max397574 commented 1 year ago

Describe the bug I lazyload lightspeed on keys depending on which key I use first dot-repeat with t doesn't work

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

To Reproduce

Steps to reproduce the behavior:

  1. nvim repro.lua -u repro.lua
  2. sa<esc>0
  3. dta
  4. . -> doesn't work
  5. ZZ
  6. nvim repro.lua -u repro.lua
  7. dta
  8. . -> works

Expected Behavior dot-repeat works in both cases

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 -- 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 = { -- do not remove the colorscheme! "folke/tokyonight.nvim", { "ggandor/lightspeed.nvim", keys = { "s", "S", "f", "F", "T","t" }, config = function() vim.keymap.set("n", "s", "Lightspeed_s") vim.keymap.set("n", "S", "Lightspeed_S") vim.keymap.set("n", "f", "Lightspeed_f") vim.keymap.set("n", "F", "Lightspeed_F") vim.keymap.set({ "n", "v", "x", "s" }, "t", "t") end, }, } require("lazy").setup(plugins, { root = root .. "/plugins", }) -- add anything else here vim.opt.termguicolors = true -- do not remove the colorscheme! vim.cmd([[colorscheme tokyonight]]) ```

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: 3 plugins

  Breaking Changes (1)
    ● lazy.nvim 3.34ms   init.lua
        4cf1f7b chore(build): auto-generate vimdoc (38 minutes ago)
        d6304f0 docs: added `keys` to packer migration (39 minutes ago)
        7f10386 chore(main): release 7.0.0 (#96) (77 minutes ago)
        50e3b91 fix(ui): sort profiling chronological by default (78 minutes ago)
        e973323 fix(ui): fixed extmarks while wrapping. Fixes #124 (2 hours ago)
        3594bfd docs: todo (2 hours ago)
        7dfb9c1 feat(ui): added options to sort/filter profiling data (2 hours ago)
        fde5fee refactor: refactored ui code (3 hours ago)
        cd023dc style: remove setting colors on startup (4 hours ago)
        e2bbf3d refactor: better annotations to make sumneko faster (5 hours ago)
        65e9036 fix: added error message to debug failing extmarks #117 (5 hours ago)
        040aeb6 chore(build): auto-generate vimdoc (5 hours ago)
        c8da1c1 docs: fixed typos and capitalization (#118) (5 hours ago)
        8bd8e6c chore(build): auto-generate vimdoc (5 hours ago)
        cc6276e refactor!: default lazy cache path is now under cache instead of state (5 hours ago)
        004b11d docs: improved docs on build. Fixes #119 (5 hours ago)
        8251c23 fix(checker): dont report updates on install during startup (5 hours ago)
        7b9b476 fix(install): make sure to setup loaders before attempting install so colorscheme can load. Fixes #122 (5 hours ago)
        e5dcc87 chore(build): auto-generate vimdoc (14 hours ago)
        8112640 feat!: `init()` no longer implies lazy-loading. Add `lazy=false` for affected plugins (14 hours ago)
        6f9845e chore(build): auto-generate vimdoc (14 hours ago)
        2a7b004 feat(spec): `config` can be `true` or a `table` that will be passed to `require("plugin").setup(config)` (14 hours ago)
        9e98389 fix(ui): fix buffer being properly deleted (#112) (15 hours ago)
        3f60f2d fix(keys): key handlers were not working after reload (15 hours ago)
        b5d6afc fix(manage): do not reload pugins on clear (15 hours ago)
        037973c chore(build): auto-generate vimdoc (16 hours ago)
        b440b3a fix(keys): don't create with remap! (16 hours ago)
        9e869a4 docs: migration (16 hours ago)
        72b3899 fix(keys): dont delete handlers manually. Let loader do that (18 hours ago)
        08d458c fix: remove debug print (18 hours ago)
        455a1f4 chore(build): auto-generate vimdoc (18 hours ago)
        2756a6f fix!: run `init()` before loading start plugins. Fixes #107 (18 hours ago)
        fb8287c chore(build): auto-generate vimdoc (19 hours ago)
        4b4ccdb docs: Add migration for tag = '*' from packer (#105) (19 hours ago)
        56890ce fix: remove lazy keymaps with the correct mode. Fixes #97 (19 hours ago)
        42f5aa7 fix: pass plugins instead of plugin names to command. Fixes #103 (20 hours ago)
        4bf771a feat(spec): allow using plugin names in dependencies (20 hours ago)
        eb01b6d chore(build): auto-generate vimdoc (23 hours ago)
        07b4677 feat(loader): automatically lazy-load colorschemes (23 hours ago)
        210d170 chore(main): release 6.0.0 (#76) (26 hours ago)
        3415a61 fix(ui): properly wrap ui elements on small screens. Fixes #92 (26 hours ago)
        c0c2e1b fix(cmd): allow ranges. Fixes #93 (26 hours ago)
        a8fe63e chore(build): auto-generate vimdoc (27 hours ago)
        1c07ea1 feat(keys): more advanced options for setting lazy key mappings (27 hours ago)
        28f1511 fix: show mapleader warning with vim.schedule. Fixes #91 (28 hours ago)
        2200284 fix(cache): overwrite cache entry with new modpath when loading a file. Fixes #90 (28 hours ago)
        6304231 feat(ui): show modpaths in debug (28 hours ago)
        dd9648f fix(clean): update lockfile on clean (#88) (29 hours ago)
        63418e8 chore(build): auto-generate vimdoc (29 hours ago)
        488b487 fix(git): remove --also-filter-submodules. Fixes #86 #83 (29 hours ago)
        dc150df test(lockfile): create config dir if it does not exist (2 days ago)
        4cf176b fix(install): update lockfile also on install (2 days ago)
        7f6f31d fix(git): make sure we properly fetch git submodules. Fixes #72 (2 days ago)
        a39d37b chore(build): auto-generate vimdoc (2 days ago)
        2e14a2f feat: added support for `nvim --headless "+Lazy! sync" +qa` (2 days ago)
        bc61747 feat!: lazy api commands now take an opts table instead of a list of plugins (2 days ago)
        fd1fbef feat(checker): defer checker to after VeryLazy to make sure nvim-notify and others are loaded (2 days ago)
        58f0876 fix: removed spell again from site. not needed. can download in config/spell (2 days ago)
        94d0125 fix(rtp): keep site in rtp (2 days ago)
        6dbcdce chore(build): auto-generate vimdoc (2 days ago)
        1fb10b9 docs: 'cmd' repeat twice (#75) (2 days ago)
        472a091 chore(main): release 5.2.0 (#55) (2 days ago)
        f0e1b85 feat: make hover easy to override (2 days ago)
        2ab6518 fix(keys): feedkeys should include pending keys. Fixes #71 (2 days ago)
        d34a02d ci: Update issue templates (2 days ago)
        2fd78fb fix(help): sort tags files for readmes so tags work properly. Fixes #67 (2 days ago)
        eab449b build: added .repro and debug to .gitignore (2 days ago)
        b7c489b fix(loader): lua modules can be links instead of files. Fixes #66 (2 days ago)
        7a57ea2 chore(build): auto-generate vimdoc (2 days ago)
        c228908 fix(health): don't show warning on `module=false` (2 days ago)
        b68f94b ci: Update issue templates (2 days ago)
        bbebb67 ci: Update issue templates (2 days ago)
        95fc814 chore(build): auto-generate vimdoc (2 days ago)
        876f7bd feat(loader): allow to add extra paths to rtp reset. Fixes #64 (2 days ago)
        a345649 fix(cache): if we can't load from the cache modpath, find path again instead of erroring right away (2 days ago)
        bbace14 fix(git): only mark a plugin as dirty if an update changed the commit HEAD. Fixes #62 (2 days ago)
        a939243 fix(checker): allow git checks only for non-pinned plugins (#61) (2 days ago)
        57bea32 chore(build): auto-generate vimdoc (2 days ago)
        ff24f49 fix(loader): source rtp `/plugin` files after loading start plugins. Fixes (2 days ago)
        b802729 chore(build): auto-generate vimdoc (2 days ago)
        9dfefac docs: fixed indentation of auto-generated code blocks (2 days ago)
        71b2e2f docs: lazy works on all OSs now (2 days ago)
        232232d fix(ui): install command can have plugins as a parameter (2 days ago)
        4ca3039 feat(loader): warn when mapleader is changed after init (2 days ago)
        540847b fix: strip `/` from dirs. Fixes #60 (2 days ago)
        86eaa11 fix(git): dereference tag refs. Fixes #54 (2 days ago)
        e95da35 feat(util): utility method to get sync process output (2 days ago)
        3c3a711 chore(build): auto-generate vimdoc (2 days ago)
        44f80a7 feat(plugin): allow plugin files only without a main plugin module. Fixes #53 (2 days ago)
        f5734f5 chore(build): auto-generate vimdoc (2 days ago)
        3814883 fix(ui): set current win only when its valid (2 days ago)
        3a7b8c8 chore(main): release 5.1.0 (#30) (3 days ago)
        3606d62 fix: add after directories to rtp to make after/ftplugin and others work. Fixes #47 (3 days ago)
        b193f96 fix(spec): only process a spec once (3 days ago)
        7be46bc style: removed unused requires (3 days ago)
        897d6df fix: add filetype to window buffer. (#41) (3 days ago)
        14300b3 chore(build): auto-generate vimdoc (3 days ago)
        78e9d6c docs: add a note about mapleader (3 days ago)
        06ac8bd perf(ui): clear existing extmarks before rendering (3 days ago)
        ffcd0ab fix(loader): source filetype.lua before plugins. Fixes #35 (3 days ago)
        9d12cdc fix(git): don't run git log for submodules. Fixes #33 (3 days ago)
        06ffcf5 chore(build): auto-generate vimdoc (3 days ago)
        7fb0652 docs: added docs on update checker (3 days ago)
        1f86cb3 chore(build): auto-generate vimdoc (3 days ago)
        3cffb2a docs: added change detection to the readme (3 days ago)
        6c767a6 feat: added options to configure change detection. Fixes #32 (3 days ago)
        cd162f3 chore(build): auto-generate vimdoc (3 days ago)
        941df31 feat(ui): make the windoww size configurable. Fixes #34 (3 days ago)
        5298441 fix: use nvim_feekeys instead of nvim_input for keys handler. Fixes #28 (3 days ago)
        2927b05 docs: added lincense (3 days ago)
        4d78203 chore(main): release 5.0.1 (#17) (3 days ago)
        1371a14 fix(build): use the shell to execute build commands (3 days ago)
        ffabe91 fix(cache): if mod is loaded already in the loader, then return that (3 days ago)
        316503f fix: dont autoload cached modules when module=false (3 days ago)
        992c679 fix: always set Config.me regardless of reset rtp (3 days ago)
        df6c986 fix: add neovim libs to rtp for treesitter parsers etc (3 days ago)
        49b69b7 chore(build): auto-generate vimdoc (3 days ago)
        e9d3a73 fix: default logs are now since 3 days ago to be in line with the docs (3 days ago)
        4234322 chore(build): auto-generate vimdoc (3 days ago)
        6e32759 fix: deepcopy lazyspec before processing (3 days ago)
        ec0f8d0 docs: added config.dev.path to the example (3 days ago)
        6404d42 fix: move re-sourcing check to the top (3 days ago)
        ddf36d7 fix: checker should not error on non-existing dirs (3 days ago)
        50ba619 test: fix tests (3 days ago)
        f78d8bf fix: show error when merging, but continue (3 days ago)

  Log (1)
    ● tokyonight.nvim 0.18ms  start
        8b55a47 fix: revert last change (3 days ago)
        ce92e5b chore(docs): auto generate vimdoc (3 days ago)
        1356b20 fix: always clear before setting colorscheme (3 days ago)

  Installed (1)
    ○ lightspeed.nvim

If I remove the keys lazy loading it also works

folke commented 1 year ago

vim.keymap.set({ "n", "v", "x", "s" }, "t", "t")

What do you want to do here?

That;s the reason it doesn't work. This is a recursive mapping?

folke commented 1 year ago

Without the keys the issue is the same. It's just that mapping that's wrong

folke commented 1 year ago

but without that keymap and without keys it still doesn't work. Either way, this has nothing to do with lazy