xeluxee / competitest.nvim

CompetiTest.nvim is a Neovim plugin for Competitive Programming: it can manage and check testcases, download problems and contests from online judges and much more
GNU Lesser General Public License v3.0
381 stars 15 forks source link

autocommands for writing and closing editor #25

Closed RishabhRD closed 1 year ago

RishabhRD commented 1 year ago

This PR is implementation of some features requested in #24 . Specifically it implements the following:

There is a similar feature that can be developed over similar lines and maybe pushed with same PR, that is to close other competitest runner window, when we close one of them (using :q)

The intent of the PR is to make competitest UI interaction work as close as possible to native vim keybindings, so that adding any testcase and other operations can be made as fast as using native vim keybindings.

We can discuss if these changes are aligned to project goals or not. And if there are any changes necessary for PR, we can do the same.

Thanks, Rishabh Dwivedi

xeluxee commented 1 year ago

Everything works fine but I've fixed your implementation to use functions that already exists

Before merging I'd like to get a similar behavior for runner UI (closing with :q), but it's less straightforward due to viewer popup. But I can't use autocommands for runner UI right now, see https://github.com/MunifTanjim/nui.nvim/issues/236 for details.

xeluxee commented 1 year ago

@RishabhRD please try out the latest commit, :q now works with runner UI too

RishabhRD commented 1 year ago

Hi @xeluxee , thanks for taking this PR forward. I didn't have time to do the required changes in these few days.

@RishabhRD please try out the latest commit, :q now works with runner UI too

Yeah, runner UI works great.

However, there is problem with editor UI now. It doesn't get closed when I close with :q.

Seems like this is something related to https://github.com/MunifTanjim/nui.nvim/issues/236

RishabhRD commented 1 year ago

I made the required changes for the PR to make editor UI work again.... We can discuss if there are any problems with defining autocmds before mounting.

xeluxee commented 1 year ago

However, there is problem with editor UI now. It doesn't get closed when I close with :q. Seems like this is something related to https://github.com/MunifTanjim/nui.nvim/issues/236

@RishabhRD please update nui.nvim to the latest commit

RishabhRD commented 1 year ago

@xeluxee I reverted the commit I made. It works fine with your changes. I guess we can now merge the feature and hope it would be helpful for others too.

And again thanks @xeluxee for taking the development of PR forward as it would have taken long time if I would have done the development bcz of lack of time.