noib3/nvim-oxi

`println!` writes to nvim process

patata3000 opened this issue · 4 comments

Hey! Sorry to bother, it may not even be a problem coming from nvim-oxi but when I add some println!, neovim catch those and prints them wherever the cursor is.

The println! is coming from a library that I can use either as a library (called by nvim-oxi bindings) or, by CLI.

In the first case (from nvim-oxi), I would like to log to nvim logs or if it's too complicated, I would like to just get rid of them.

In the second case (from CLI), I just want them to be printed to stdout.

Is there or way that doesn't involve too much overhead?

Use nvim_oxi::print!.

Hey thanks for answering quickly!

I want my library to be independent from nvim. So I want to be able to sometimes print in nvim (to the nvim logs) and sometime print to the stdout.

When I use println!, it always prints to stdout but it messes up nvim UI. I don't know how to rewire these println! to for example /dev/null

Then you'd have to create a separate macro that delegates to either nvim_oxi::print! or to println! based on a feature flag set at compile or on a global variable set at runtime.

However this has nothing to do with this specific project, try asking in the Rust forum instead.

Thank you very much. This is what I needed