micro icon indicating copy to clipboard operation
micro copied to clipboard

Custom keybinding for "Quit, without saving" possible?

Open zanglebert opened this issue 8 years ago • 6 comments

Hi

I've tried to define a custom keybinding for "Quitting without saving", i.e. a keybinding that automatically enters "n" in the "Save? y/n/escape" dialogue that follows a Quit command in a changed file. My first idea was something like: "CtrlQ": "Quit,"N", but I realize that doesn't work, since "N" is a key event, not a command. Next attempt: "CtrlQ": "Quit,"command:echo'n'", but that's wrong on several levels I guess.

Anyway, I'm fresh out of ideas. Is this even possible, given the limitations of both the (OS X) terminal, and the available actions defined by Micro?

zanglebert avatar Oct 12 '18 17:10 zanglebert

@zanglebert oh no, you shouldn't create such shortcut key, it's basically not safe.

datdinhquoc avatar Oct 12 '18 21:10 datdinhquoc

@datdinhquoc Care to explain why it's not safe? I'm not suggesting to only have a short cut like that, but in addition to the default behavior.

Here's the reason why I want to define it: I frequently open files I don't want to make changes to, but read them in Micro nonetheless. I also frequently mistakenly edit them anyway (fat finger etc), then have to go through the save dialogue, carefully checking that I don't save by accident. Having a key that closes without saving is useful here, and I don't know why you'd consider it unsafe.

zanglebert avatar Oct 15 '18 09:10 zanglebert

then you will have habit of pressing such shortcut key, and hey ho, one day you forget to ctrl+s before exiting directly that way.

datdinhquoc avatar Oct 16 '18 01:10 datdinhquoc

+1 need this feature

exebook avatar Feb 14 '19 11:02 exebook

You can probably do this with very little code inside init.lua, no?

phil294 avatar Apr 18 '21 20:04 phil294

The ForceQuit action exists now.

Andriamanitra avatar Sep 09 '26 21:09 Andriamanitra