vamolessa / pepper

simple and opinionated modal code editor for your terminal
https://vamolessa.github.io/pepper/
372 stars 17 forks source link

Add `save-quit` and `save-quit-all` commands #49

Closed NNBnh closed 2 years ago

NNBnh commented 2 years ago

I surprise that there is no way to save and quit at with one command like wq on Vim, Kakoune or Helix when this is a very commonly used operation:


save-quit

Saves buffer to file then quits this client. If <path> is present, it will use that path so save the buffer's content, making it the new buffer's associated filepath (it will also enable saving for that buffer from now on).

save-quit-all

Saves all buffers to file then quits all clients.


These commands will be very convenient but I could see why this command doesn't exist in the first place, it's a bit redundant and seem like something the user could config to achieve...:

If you find this suggestion it's suitable to be built-in with the editor, feel free to label this issue with "Plugin" or "Plugin Idea".

vamolessa commented 2 years ago

This could be accomplished by adding these to your config file:

command save-quit @{
    save @arg(*)
    quit@arg(!)
}
command sq @{ save-quit@arg(!) @arg(*) }
command save-quit-all @{
    save-all
    quit@arg(!)
}
command sqa @{ save-quit-all@arg(!) @arg(*) }

I'll add this to the config recipes page!

NNBnh commented 2 years ago

Thanks! I somehow missed that user can create custom commands...