Cluttered as our keyboards are with key-binds, it's always nice when we can
combine two disjoint functionalities in the same key. I have M-k and C-M-k
bound to killing the next and previous sexp, respectively, but that is never
something I need inside a string or when typing a file name in the minibuffer.
Then these keys become utterly useless!
The solution to this conundrum is, of course, to find another use for them in
these cases. Something that comes up regularly inside strings (or file-name
prompts) is killing an entire directory name.
The code below, binds M-k to a command that automatically decides whether to
kill a sexp or a directory name. The decision making is a little tricky, but it
has yet to let me down.
Kill Sexp or Directory
07 Apr 2015, by Artur Malabarba.Cluttered as our keyboards are with key-binds, it's always nice when we can combine two disjoint functionalities in the same key. I have M-k and C-M-k bound to killing the next and previous sexp, respectively, but that is never something I need inside a string or when typing a file name in the minibuffer. Then these keys become utterly useless!
The solution to this conundrum is, of course, to find another use for them in these cases. Something that comes up regularly inside strings (or file-name prompts) is killing an entire directory name.
The code below, binds M-k to a command that automatically decides whether to kill a sexp or a directory name. The decision making is a little tricky, but it has yet to let me down.
Tags: convenience, keybind, init.el, emacs,
(Very Late) SX.el Announcement, and more launcher-map »
« Cider-debug, a visual, interactive, debugger for Clojure
Related Posts
A quick guide to directory-local (or project-specific) variables in convenience
A few paredit keys that take over the world in keybind
Fill and unfill paragraphs with a single key in convenience
Content © 2019, All rights reserved. Icons under CC3.0.