Skip to main content

Emacs Windows key

How to use the Windows key in Emacs keybindings

On my keyboard, there is a key with the Windows logo between Ctrl and Alt. I want to use it for my Emacs keybindings
In Emacs, the "Windows key" is named "Super". In keybindings it is lowecase "s".
So, for example, if you want to set:
"Windows + TAB" key combination:
s-<tab>
"Windows + Enter" key combination:
s-<return>
"Windows + Arrow down" key combination:
s-<down>
"Windows + Arrow right" key combination:
s-<right>
Short example:
(define-key copilot-mode-map (kbd "s-<next>") #'copilot-next-completion)
(define-key copilot-mode-map (kbd "s-<prior>") #'copilot-previous-completion)
(define-key copilot-mode-map (kbd "s-<right>") #'copilot-accept-completion-by-word)
(define-key copilot-mode-map (kbd "s-<down>") #'copilot-accept-completion-by-line)
(define-key global-map       (kbd "s-<return>") #'rktmb/copilot-complete-or-accept)