I'm using OSX 10.9, iTerm2, Emacs Prelude, and Clojure with all the modes that entails most relevantly, smartparens
. Good so far.
The short version is: has anybody out there found a harmonious way to use all of this together with OSX Mission Control?
The longer version goes: I want to be able to use commands like sp-forward-slurp-sexp
, which has a default keybinding of C-<right>
, better known as the default OS-level shortcut for "switch Spaces right via Mission Control." I can re-map that fairly easily (say, to C-Shift-<right>
) -- but now, I discover that C-<right>
actually seems to be sending something like M-[1;4A
. Instead of triggering sp-forward-slurp-sexp
, you get sp-wrap-with-pair "["
. Uhm.
I dug up this dissertation on re-mapping keys, which is very thorough, but also involves re-mapping rather a deal of stuff, then disabling the parts of paredit
that are listening for the M-[
command. While this technically seems to work, I actually rather like having sp-wrap-with-pair
enabled. Perhaps a better option would be to embrace the theoretically equivalent C-(
-- except iTerm2 only interprets that as a literal 9, and C-)
as 0. This SO post chews on this problem, and gets as far as a tantalizing comment suggesting that C-(
and C-)
simply be re-mapped to escape sequences that emacs can map back to C-(
and C-)
-- but frankly, I haven't a clue how to figure out what escape sequences those should be.
Bringing it all home: has anybody found a way to use all of these tools (Mission Control, iTerm2, Emacs Prelude, smartparens) together without having to re-wire or disable parts of some or most of them? Or: who has the most elegant re-wiring? Anybody figured out the C-)
-to-escape-sequence-back-to-C-)
trick yet?
Edit
Stabbing in the dark, I've done the following:
1. Set iTerm to send an escape sequence for the keyboard shortcut Ctrl-Shift-0 (C-S-)
) of SPRTPRN
.
2. Put this in my emacs config:
(define-key input-decode-map "\eSPRTPRN" [C-right-paren])
(global-set-key [C-right-paren] (kbd "C-)"))
...it does not work, but I've a hunch I'm getting closer. I think.
Edit, Again
I realized something: the notion that Shift doesn't work here doesn't make sense to me. At least on my emacs install, M-< and M-> jump to the beginning and end of a buffer, respectively -- and to use those commands, I have to actually press Meta-Shift-<. Huh.