Giter VIP home page Giter VIP logo

Comments (6)

Iron-E avatar Iron-E commented on May 29, 2024 2

I transferred this issue to this repo since you're using nvim-libmodal.

Thanks for the clear version statements, that really helps 👍

As for the issue, I see this:

command! WindowMode call libmodal#Enter('Window', funcref('s:WindowMode'))

The lua-vim interface doesn't like to process funcrefs. You can read more about that here, but in short:

  • The ability to resolve funcrefs wasn't added until a recent 0.5 nightly.
  • You can't directly pass the funcref() result, instead, you must pass the name of the function.

So the command would look like this:

command! WindowMode call libmodal#Enter('Window', 's:WindowMode')

Thought it won't work without 0.5.

The reason it works with vim-libmodal is that it is written entirely in Vimscript, so it never has to cross that barrier from Lua to Vim (and thus never has to deal with resolving the funcref()).

You can test this solution out by downloading Neovim 0.5 and replacing the command with the one I provided.

Let me know if it works!


Edit: Another way to get around this would be to write your mode in Lua. This approach doesn't require Neovim 0.5

Start by defining a module:

-- yourproject/lua/window_mode.lua
local libmodal = require('libmodal')

local function WindowMode()
    -- logic goes here
end

return function() 
    libmodal.mode.enter('Window', WindowMode) 
end

Then define the Vimscript bindings:

command! WindowMode lua require('window_mode')()

Both approaches will work.

from nvim-libmodal.

chardskarth avatar chardskarth commented on May 29, 2024 1

I'll have to make do with using vim-libmodal for now.
Thank you very much. Closing this issue now.

PS I can't thank you enough for this plugin. This really helped me in my workflow!

from nvim-libmodal.

Iron-E avatar Iron-E commented on May 29, 2024

Thanks for the report!

It seems like nvim-libmodal is installed, which is only for Neovim. The function in the error comes from this file on that other repo.

These two plugins (vim-libmodal and nvim-libmodal) are somewhat cross-compatable but can't be installed at the same time. Can you confirm the following for me? It will help in debugging this issue:

  • Vim version (Neovim/Vim)
  • libmodal version (nvim-/vim-)

Thanks!

from nvim-libmodal.

chardskarth avatar chardskarth commented on May 29, 2024

Neovim: 0.4.3
nvim-libmodal: dee1f0f

vim-libmodal: e842912 works somehow. Awesome work! I'm very thankful for your library.


Edit: Sorry I dont know how to get the version. I cded to the plugins directory and simply did a glol

from nvim-libmodal.

chardskarth avatar chardskarth commented on May 29, 2024

I dont have vim-libmodal installed. Here's my neovim autoload folder:

image

from nvim-libmodal.

Iron-E avatar Iron-E commented on May 29, 2024

Happy to help! I posted another solution that doesn't require 0.5, which you can take a look at.

In the meantime, feel free to open any additional tickets as necessary 👍

from nvim-libmodal.

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.