From:     Fraga, Eric
Subject:     Re: Orgmode keybindings in Dired?
Date:     Fri, 23 Aug 2024 12:51:32 +0000
User-agent:     gnus (Emacs 31.0.50)

Response below/inline for email Kepa wrote:
> (original email sent 22 Aug 2024 at 18:27)
> I'm starting to use Dired and I like it.

dired is an excellent tool!

> I would like to know your opinion, fellow orgmode users about
> keybindings in Dired:
> Is it worth modifying Dired's keybindings to match those of Org-mode?

What exactly are you imagining?  org mode keybindings make sense within
an org file.  I'm not sure what you expect to do in a dired buffer that
would use org mode keybindings?

Having said that, I do use org-store-link (globally bound to C-c l) all
the time in dired buffers.

--
: Eric S Fraga, with org 9.7.10-5ebd97 in Emacs 31.0.50

By the way, Eric, thanks for your tip. I probably wouldn't found that org-store-link can be used in Dired. Combined with org-super-links and org-open-at-point, it makes it joyful.

You asked about what was I imagining, so I will share the configuration I have finished with (by now).

My imagination goes beyond, though, like using "r" and "l" to "move" subdirectories one level down or up. Although maybe I would never use it. As said, the keybindings I am using in Dired, inspired many of them by org-mode keybindings:

;; Bind 'TAB' to toggle subtree visibility (cycle through subdirectories)
(with-eval-after-load 'dired
  (define-key dired-mode-map (kbd "TAB") 'dired-subtree-cycle))

;; Create a new directory (similar to 'M-RET' in Org-mode)
  ;; Existing Dired keybinding: '+' is used for 'dired-create-directory'
  ;; New keybinding: 'M-RET'
(define-key dired-mode-map (kbd "M-RET") 'dired-create-directory)

;; (org-speed-move-safe 'outline-up-heading) (similar to 'u' in Org-mode for dired-subtree-up)
  ;; Existing Dired keybinding: 'u' for dired-unmark
(define-key dired-mode-map (kbd "u") 'dired-subtree-up)

 ;; Bind 's' to narrow the view to the current subdirectory
(define-key dired-mode-map (kbd "s") 'dired-subtree-narrow)

(define-key dired-mode-map (kbd "U") 'dired-unmark)
(define-key dired-mode-map (kbd "C-g") 'dired-unmark-all-marks)
(define-key dired-mode-map (kbd "N") 'dired-next-line)
(define-key dired-mode-map (kbd "C-<return>") 'dired-w32explore)