Mac – How to Bind CMD+W to Kill Current Buffer in Emacs

elispemacsmac

How do I bind CMD+W to kill the current buffer in Emacs on OSX? C-x k RET is unnatural and a comparatively lengthy binding compared to CMD+W.

Best Answer

(defun kill-current-buffer ()
  (interactive)
  (kill-buffer (current-buffer)))
(global-set-key (kbd "s-w") 'kill-current-buffer)

(Credit goes to jlf at #emacs)

Related Question