开发者

Defining Control-Shift-* Emacs keyboard shortcuts

开发者 https://www.devze.com 2023-04-08 13:37 出处:网络
I\'m trying to define the following two keyboard shortcuts to move between windows in Emacs: C-shift-n: Move to the next window

I'm trying to define the following two keyboard shortcuts to move between windows in Emacs:

  • C-shift-n: Move to the next window
  • C-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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号