Coder Social home page Coder Social logo

Comments (12)

ggandor avatar ggandor commented on June 10, 2024 1

I cannot reproduce, the problem is not with this mapping itself, it should work.

from leap.nvim.

ggandor avatar ggandor commented on June 10, 2024 1

Sure, but I don't fully understand the problem (what Lazy is doing in the background), and cannot really follow the comment in your code snippet, so please walk me through this then.

from leap.nvim.

ShaolunWang avatar ShaolunWang commented on June 10, 2024 1

@Sleepful This would only work with the first leap. On the second leap it shows:

E5108: Error executing lua: ~/.local/share/nvim/lazy/leap.nvim/lua/leap/main.lua:405: attempt to index local '_local_67_' (a nil value)
stack traceback:
        ~/.local/share/nvim/lazy/leap.nvim/lua/leap/main.lua:405: in function 'leap'
        ~/.config/nvim/lua/plugins/leap.lua:11: in function <~/.config/nvim/lua/plugins/leap.lua:10>
        ```

from leap.nvim.

cd-a avatar cd-a commented on June 10, 2024 1

see LazyVim/LazyVim#2379 (comment) for solution

from leap.nvim.

ggandor avatar ggandor commented on June 10, 2024 1

TL;DR: don't use keys, it's unnecessary.

from leap.nvim.

ShaolunWang avatar ShaolunWang commented on June 10, 2024

Right, thanks for confirming that!

from leap.nvim.

ShaolunWang avatar ShaolunWang commented on June 10, 2024

I just narrowed down the issue I had,fyi this is triggered by setting it like this:

require('lazy').setup({
  {
    'ggandor/leap.nvim',
    keys = {'s'} 
    -- with this keys lazy loading option,
    -- at each leap it calls lua/leap/main.lua: line 1202
    -- it also depends on the 
    -- and it will get reset to default vim s key
  }
})

vim.keymap.set({ 'n', 'x', 'o' }, 's', function()
  local current_window = vim.fn.win_getid()
  require('leap').leap({ target_windows = { current_window } })
end, { noremap = true})

Despite said here in the readme that lazy loading isn't necessary, there would potentially still be people like me who interpret the wording as lazy loading leap wouldn't result in unexpected behavior(s). Would it be possible to state this somewhere?

from leap.nvim.

ShaolunWang avatar ShaolunWang commented on June 10, 2024

@ggandor sorry for the ping, I forgot to reopen the issue. Could you please take another look?

from leap.nvim.

ShaolunWang avatar ShaolunWang commented on June 10, 2024

So the problem I had was lazy would reset the keybinds when I use the lazy load on keypress option, if I decided to disable the default keymaps and only map s/S to leap actions. Those keybinds get reset to the vim s/S after the first leap action

from leap.nvim.

Sleepful avatar Sleepful commented on June 10, 2024

did you try this?

require('lazy').setup({
  {
    'ggandor/leap.nvim',
    keys = {
        "s",
        function()
          require('leap').leap()
        end,
        mode = { "x", "n" },
        desc = "Leap",
      }
  }
})

from leap.nvim.

cd-a avatar cd-a commented on June 10, 2024

Did anyone find a solution to this?

from leap.nvim.

ShaolunWang avatar ShaolunWang commented on June 10, 2024

I will close it since it's not a leap issue

from leap.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.