this post was submitted on 20 Nov 2023
1 points (100.0% liked)

Emacs

313 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I am 100 % a keyboard only user, but sometimes i want to relax and browse dired only with one hand. But the standart behaviour of dired , when clicking on files or directories, is really ass. Thus i wrote some code to gain this functionality:

Left-Mouse-Click: The same as Pressing Enter

Right-Mouse-Click: close current buffer and go to last visible buffer

thus you can left click on entry, then go back with right click which is super fast and handy. Try it out !!!

(I am using evil, but you can easily bind the keys with :

(define-key dired-mode-map .... )

code:

(defun my/dired-jump (event)

(interactive "e")

(mouse-drag-region event)

(dired-find-file))

(defun my/dired-jump-close ()

(interactive)

(kill-current-buffer))

(evil-global-set-key 'normal (kbd "") 'my/dired-jump-close)

(evil-define-key '(normal visual motion emacs) dired-mode-map

(kbd "") 'my/dired-jump)

EDIT: CHECK OUT THIS DEMO

https://imgur.com/a/G6K8JKO

you are viewing a single comment's thread
view the rest of the comments
[–] noooit@alien.top 1 points 1 year ago

Hi fellow mouse lover, i use it often as well.