AntonVanAssche / music-controls.nvim

Control you favorite music players with ease from within Neovim.
MIT License
16 stars 1 forks source link

[Feature] Allow `:MusicLoop` to handle default player if set #5

Closed sjclayton closed 1 month ago

sjclayton commented 1 month ago

Describe the solution you'd like

:MusicLoop should handle being passed no arguments, and use the default player (if one is set) while toggling either the default mode or potentially toggling through all available loop modes.

I may work on this myself, but don't really have time at the moment. ๐Ÿ˜

AntonVanAssche commented 1 month ago

Hi,

Unfortunately, I can't really follow it here. Since yesterday the feature your describing has already been added to the plugin.

For clarity I've added a video with the current implementation, is this what you are requesting? When no argument is passed to :MusicLoop it will default to the default player (if configured by the user), and use Track as loop mode.

https://github.com/user-attachments/assets/4237a714-746d-41bf-84ac-1fff9f37884c

Code responsible for this feature:

https://github.com/AntonVanAssche/music-controls.nvim/blob/2c8f15b633daa9895e2114aacdff42ffc24534cb/lua/music-controls/init.lua#L29-L41

AntonVanAssche commented 1 month ago

or potentially toggling through all available loop modes

This feature might be useful, feel free to take a look. If you'd rather not implement it, I'm more than happy to implement it myself.

sjclayton commented 1 month ago

Yeah :MusicLoop enables (track mode) fine with no arguments, but it should behave like a switch, if I call the command again with no args a second time, looping should be turned off... this is the behaviour I was mentioning above.

Hopefully that is a little bit clearer. ๐Ÿ˜

AntonVanAssche commented 1 month ago

After some thought, I partially agree with you on adding this feature.

In my opinion, :MusicLoop should remain unchanged, but we could introduce a new command, such as :MusicLoopToggle, which would toggle between Track and None.

The reason is that changing the behavior of :MusicLoop could disrupt workflows for other users, including mine, who rely on enabling Track mode by passing no arguments. This is already clearly defined as the default behavior in both the README and Vim help documentation.

Feel free to open a PR and implement this new command. If you don't have time, I can handle it as wellโ€”I believe it's a fairly straightforward change. ๐Ÿ˜€

AntonVanAssche commented 1 month ago

I implemented a MusicLoopToggle command in commit: b135d65b37ac042389d9df3d178b39de5381cb4f. I am closing this issue for now, if the solution is not what you were looking for, feel free to reopen it.

sjclayton commented 1 month ago

Thanks so much for adding this!! I have been super busy lately and didn't get around to it.