feat(emacs): add simple bookmarks for Dired & TRAMP

This commit is contained in:
Pavel Korytov 2021-05-02 18:16:22 +03:00
parent d4d65c6fcf
commit b5f98822bb
5 changed files with 45 additions and 3 deletions

View file

@ -5,4 +5,5 @@ Mail/thexcloud/.credentials.gmailieer.json
Mail/progin6304/.credentials.gmailieer.json
.wegorc
.msmtprc
secrets/*
secrets/*
.emacs.d/dired-bookmarks.el

Binary file not shown.

View file

@ -9,7 +9,7 @@
'(aweshell-valid-command-color "#c3e88d")
'(css-indent-offset 2)
'(custom-safe-themes
'("aaa4c36ce00e572784d424554dcc9641c82d1155370770e231e10c649b59a074" "c83c095dd01cde64b631fb0fe5980587deec3834dc55144a6e78ff91ebc80b19" "bf387180109d222aee6bb089db48ed38403a1e330c9ec69fe1f52460a8936b66" "e074be1c799b509f52870ee596a5977b519f6d269455b84ed998666cf6fc802a" default))
'("fce3524887a0994f8b9b047aef9cc4cc017c5a93a5fb1f84d300391fba313743" "5034d4b3ebd327bbdc1bbf925b6bf7e4dfbe4f3f84ee4d21e154143f128c6e04" "aaa4c36ce00e572784d424554dcc9641c82d1155370770e231e10c649b59a074" "c83c095dd01cde64b631fb0fe5980587deec3834dc55144a6e78ff91ebc80b19" "bf387180109d222aee6bb089db48ed38403a1e330c9ec69fe1f52460a8936b66" "e074be1c799b509f52870ee596a5977b519f6d269455b84ed998666cf6fc802a" default))
'(dired-recursive-copies 'always)
'(doom-modeline-env-enable-python nil)
'(jest-test-options '("--color" "--runInBand" "--forceExit"))

View file

@ -715,6 +715,10 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
;; (rainbow-delimiters-mode))))
)
(use-package rainbow-mode
:commands (rainbow-mode)
:straight t)
(use-package dired
:ensure nil
:custom ((dired-listing-switches "-alh --group-directories-first"))
@ -792,6 +796,16 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
vc-ignore-dir-regexp
tramp-file-name-regexp))
(defun my/dired-bookmark-open ()
(interactive)
(unless (boundp 'my/dired-bookmarks)
(load (concat user-emacs-directory "dired-bookmarks")))
(dired
(cdr
(assoc
(completing-read "Dired: " my/dired-bookmarks)
my/dired-bookmarks))))
(use-package vterm
:straight t
:commands (vterm vterm-other-window)

View file

@ -92,6 +92,7 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept
- [[#basic-config--keybindings][Basic config & keybindings]]
- [[#addons][Addons]]
- [[#tramp][TRAMP]]
- [[#bookmarks][Bookmarks]]
- [[#shells][Shells]]
- [[#vterm][vterm]]
- [[#configuration][Configuration]]
@ -1440,7 +1441,7 @@ So far I found the following problematic plugins:
| projectile | looks for .git, .svn, etc | advice ~projectile-file-name~ |
| lsp | does a whole lot of stuff | disable |
| git-gutter | runs git | disable |
| vterm | no proper TRAMP integration | use eshell |
| vterm | no proper TRAMP integration | use eshell or shell |
At any rate, it's usable, although not perfect.
@ -1452,6 +1453,32 @@ Some other optimization settings:
vc-ignore-dir-regexp
tramp-file-name-regexp))
#+end_src
** Bookmarks
A simple bookmark list for Dired, mainly to use with TRAMP. I may look into a proper bookmarking system later.
Bookmarks are listed in the [[file:.emacs.d/dired-bookmarks.el][dired-bookmarks.el]] file, which looks like this:
#+begin_example emacs-lisp :tangle no
(setq my/dired-bookmarks
'(("sudo" . "/sudo::/")))
#+end_example
The file itself is encrypted with yadm.
#+begin_src emacs-lisp
(defun my/dired-bookmark-open ()
(interactive)
(unless (boundp 'my/dired-bookmarks)
(load (concat user-emacs-directory "dired-bookmarks")))
(let ((bookmarks
(mapcar
(lambda (el) (cons (format "%-30s %s" (car el) (cdr el)) (cdr el)))
my/dired-bookmarks)))
(dired
(cdr
(assoc
(completing-read "Dired: " bookmarks nil nil "^")
bookmarks)))))
#+end_src
* Shells
** vterm
My terminal emulator of choice.