I'm trying to remap some keys in dired like this:
(add-hook 'dired-mode-hook
(lambda ()
(require 'dired )
(define-key dired-mode-map (kbd "M-o") nil)))
(define-key dired-mode-map (kbd "M-o") 'other-window)
))
Unfortunately this doesn't seem to work, I get this error
Symbol's value as variable is void: dired-mode-map
Which is werid, because I should be loading in dired. What could I be doing wrong?
The original poster has two (2) many [pun intended] closing parentheses at this point: (define-key dired-mode-map (kbd "M-o") nil)))
-- i.e., two (2) closing parentheses at the end of that line need to be eliminated. Furthermore, I do not see a reason to set the binding to nil
before redefining it.
The following is another way of accomplishing the same goal. Add any additional key bindings after the progn
statement as desired.
(eval-after-load "dired" '(progn
(define-key dired-mode-map (kbd "M-o") 'other-window) ))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With