Defining Control-Shift-* Emacs keyboard shortcuts
I'm trying to define the following two keyboard shortcuts to move between windows in Emacs:
C-shift-n:
Move to the next windowC-shift-b:
Move to the previous window
I thought the following will do it but it doesn't.
(defun select开发者_JAVA技巧-next-window ()
"Switch to the next window"
(interactive)
(select-window (next-window)))
(defun select-previous-window ()
"Switch to the previous window"
(interactive)
(select-window (previous-window)))
(global-set-key (kbd "C-<S-n>") 'select-next-window)
(global-set-key (kbd "C-<S-p>") 'select-previous-window)
The problem seems to be with the last two lines that define the actual keyboard shortcuts to the functions that switch the windows (if I use simpler keyboard shortcuts instead of Control-Shift-*
it works).
So, how do I use kbd
to define Control-Shift-n
and Control-Shift-p
?
Assuming you never use caps lock, here's a super simple solution:
(global-set-key (kbd "C-N") 'select-next-window)
or
(global-set-key (kbd "C-<S-N>") 'select-next-window)
The problem is that when you hit shift you're sending capital N.
精彩评论