Delapouite / kakoune-buffers

Ease navigation between opened buffers
http://kakoune.org
67 stars 8 forks source link

Add configurable buffer_alternate_command option #23

Open jordan-yee opened 3 years ago

jordan-yee commented 3 years ago

The buffers user-mode provides the a key mapping to switch to an alternate buffer, but it is currently just a pass-through to ga.

This PR adds a configurable option for setting a custom command for switching to an alternate buffer. The intended use case is to provide a command to switch to a test or spec file as the alternate file, if one exists, rather than the previous buffer.

While looking through the filetype scripts bundled with Kakoune I noticed that more than one filetype script provides an alternate file command along with an 'alt' alias. I think it would be a good idea to simply attempt the 'alt' command alias as a default for the 'a' mapping, with ga as a fallback because it would Just Work for certain file types without changing the behavior for others. However, I went the route of leaving the default behavior unchanged and up to the user, while suggesting this in the README instead.