I'm trying to create a different keybinding to abort a commit in magit. Right now, when you're editing a commit message C-c C-k
is bound to with-editor-cancel
, which does the trick. But I'm an evil user and prefer vim-style keybindings, and I actually use evil-escape to set most of my bail-out keybindings to ESC ESC
.
My first thought was to just provide a different keybinding for with-editor-cancel
, like to bind it in normal state to ESC ESC
to match the rest of my escape keys. But here's the problem: Magit commit edit buffers appear to run under text major mode which a bunch of other modes I use constantly inherit from (markdown, org, etc.) And with-editor-cancel
appears to be super-dangerous to have bound to a key normally. I tried it out on an org file just to see what would happen, and it not only killed the buffer without any confirmation, but also deleted the underlying file from the file system (!!!). This is not something I want to accidentally call.
So, like, is there some way to define a keybinding only on those text-mode buffers that happen to have been created by magit?
(Most of my keybindings are defined with general, but I'm happy to do it some other way.)