Giter Club home page Giter Club logo

Comments (4)

noib3 avatar noib3 commented on June 7, 2024

What version of Neovim does this happen on?

from nvim-oxi.

ReeceStevens avatar ReeceStevens commented on June 7, 2024

I feel pretty foolish for this oversight-- it is happening on neovim 0.8.0. Looking back at my linux box, I was still running 0.7.2 on there, and after upgrading I also see a segfault. So, my assumption about this being macos-specific seems to be incorrect.

I will try and downgrade my macOS neovim instance to 0.7.2 and see if my test case starts working again. Is there any other information you need that might be helpful?

from nvim-oxi.

noib3 avatar noib3 commented on June 7, 2024

Plugins created with nvim-oxi are compiled against a specific version of Neovim. Before Neovim 0.8.0 was released the default was to build against 0.7.2, and we had a nightly feature flag to enable for targeting Neovim nightly. I'm assuming you didn't enable that feature so your plugin is being compiled for 0.7.2 but loaded by 0.8.0, causing the segfault.

With that said, this system has been recently rewritten to be more explicit, and it'll be added in the 0.2.0 release of nvim-oxi in the coming days.

In the meantime I'd suggest using the latest master of nvim-oxi in your Cargo.toml. Then you'll have to enable one of the neovim-0-7, neovim-0-8 or neovim-nightly features depending on the Neovim version you're targeting.

There were also some breaking changes since 0.1.3 so the code above won't compile. This should however:

use nvim_oxi as oxi;
use nvim_oxi::api::{
    self,
    opts::CreateCommandOpts,
    types::{CommandArgs, CommandNArgs, CommandRange},
};

#[oxi::module]
fn vim_plugin_test() -> oxi::Result<u32> {
    let opts = CreateCommandOpts::builder().build();

    let greetings = move |args: CommandArgs| {
        api::out_write("Test");
        Ok(())
    };

    api::create_user_command("Greetings", greetings, &opts)?;

    Ok(42)
}

(btw, you can use CreateCommandOpts::default() instead of builder().build()).

from nvim-oxi.

ReeceStevens avatar ReeceStevens commented on June 7, 2024

@noib3 thank you so much for your quick, detailed, and very helpful responses. You were right on the money; I needed to compile against neovim 0.8.0. After doing so, I was able to get my plugin up and running.

I'm going to go ahead and close this issue. I appreciate the help!

from nvim-oxi.

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.