oni icon indicating copy to clipboard operation
oni copied to clipboard

Some event handlers with specific file patterns don't get triggered

Open numirias opened this issue 8 years ago • 4 comments

Oni Version: 0.3.4 Neovim Version (Linux only): 0.2.2 Operating System: 4.16.10-1-ARCH x86_64 GNU/Linux

Describe your issue

I'm developing a Python plugin for Neovim which does some initialization on VimEnter/BufEnter when editing Python files. However, the event handlers don't get triggered inside Oni when they are limited to a file pattern.

Expected behaviour

The event handlers for VimEnter, GUIEnter and BufEnter should be triggered when Oni starts up with e.g.:

$ oni existing_file.py

Actual behaviour

None of the events seems to get raised.

Steps to reproduce

Take this sample plugin:

import neovim

@neovim.plugin
class Plugin:

    def __init__(self, nvim):
        self.nvim = nvim

    @neovim.autocmd('BufEnter', pattern='*.py')
    def event_buf_enter(self):
        self.nvim.err_write('BufEnter triggered!\n')

Install the plugin and start Oni with a file argument:

$ oni existing_file.py

The event handler will not be triggered unless you change the pattern argument to *.

(Reference ticket: numirias/semshi/issues/10)

numirias avatar May 26 '18 20:05 numirias

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

oni-bot avatar May 26 '18 20:05 oni-bot

I'm having a bit of look into this (slightly slower than I'd like due to being away from my PC due to a cancelled train).

First thing I've noticed is that opening things the "Oni" way (That QuickOpen/Sidebar/Opening with Open) doesn't print the 'BufEnter triggered!\n' message. However, opening files with :e my_file.py works just fine and triggers the event. It looks like in some fashion our events are not launching these events? Not fully sure why that would be the case, but I'll keep looking.

CrossR avatar May 28 '18 20:05 CrossR

@CrossR I wonder if when opens a file the oni way if a bufEnter is triggered considering those events go via the neovim api, I'm wondering if its possible our events don't aka calls via the api don't result in a normal neovim event? tbh if thats the case could be the cause of a lot of weird behaviour

akinsho avatar May 29 '18 16:05 akinsho

I've found the reason why this happens but it comes down as a bigger problem so I'm gonna open a separate issue. (#2323 )

GeorgeTG avatar Jun 15 '18 14:06 GeorgeTG