I'm tryng to bind F6 to dired-up-directory using
(global-set-key (kbd "<f6>")
but when I use this in dired-mode, I get
<f6>
is undefined.
What have I done wrong?
You need to provide the command that you want to bind to that key, as the second argument to global-set-key
: (global-set-key (kbd "<f6>") #'dired-up-directory)
. Your sexp isn't even closed - it's missing a right paren (as well as a second argument).
But really you don't want to bind that key globally to dired-up-directory
(do you?). You want to bind it to that command only in dired-mode
:
(define-key dired-mode-map (kbd "<f6>") #'dired-up-directory)
dired-mode
then dired-mode-map
is defined.
dired-mode
? dired-mode-map
is, and should be, defined globally. It is used in dired-mode
.