Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not registering plugin command #576

Open
huberb opened this issue Sep 22, 2024 · 1 comment
Open

Not registering plugin command #576

huberb opened this issue Sep 22, 2024 · 1 comment
Labels

Comments

@huberb
Copy link

huberb commented Sep 22, 2024

I'm trying to add a new command to neovim using this project. This is my code:

import pynvim
import inspect
import logging

logging.basicConfig(filename='/path/to/logs.txt', level=logging.DEBUG)
logging.debug("file loaded")

@pynvim.plugin
class TestPlugin:
    def __init__(self, nvim):
        self.nvim = nvim
        logging.debug("TestPlugin loaded")

    @pynvim.command('TestCommand', nargs='*', range='', sync=True)
    def test_command(self, args, range):
        logging.debug("TestCommand triggered")
        self.nvim.out_write("TestCommand executed\n")

my log file shows "file loaded", but nothing else. It seems like the class is never instanciated. Logging output from inside the class is never written

I'm loading this using the following lines in my init.lua:

vim.api.nvim_command("python3 import my_plugin")

Which seems to be correct. The file is loaded when starting neovim

I'm using neovim 0.10.1 and python 3.11.5

Is there anything wrong with my approach? I assumed the class will be instanciated and registered automatically

@justinmk
Copy link
Member

The remote plugin concept will be removed, because it's not needed if pynvim just provides a set_handler function. See #567

@b0o any chance you can implement set_handler in pynvim?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants