(Emacs)+local-leader and some binds for dired and eshell using it
This commit is contained in:
@@ -245,8 +245,11 @@ common use of this macro.
|
|||||||
* Core packages
|
* Core packages
|
||||||
** General
|
** General
|
||||||
Setup general, a good package for defining keys. In this case, I
|
Setup general, a good package for defining keys. In this case, I
|
||||||
generate a new definer for the "LEADER" keys. Leader is bound to SPC
|
generate a new definer for the "LEADER" keys. Leader is bound to
|
||||||
and it's functionally equivalent to the doom/spacemacs leader.
|
=SPC= and it's functionally equivalent to the doom/spacemacs leader.
|
||||||
|
Local leader is bound to =SPC ,= and it's similar to doom/spacemacs
|
||||||
|
leader but doesn't try to fully assimilate the local-leader map
|
||||||
|
instead just picking stuff I think is useful.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package general
|
(use-package general
|
||||||
:demand t
|
:demand t
|
||||||
@@ -262,6 +265,10 @@ and it's functionally equivalent to the doom/spacemacs leader.
|
|||||||
:keymaps 'override
|
:keymaps 'override
|
||||||
:prefix "SPC")
|
:prefix "SPC")
|
||||||
|
|
||||||
|
(general-create-definer local-leader
|
||||||
|
:states '(normal motion)
|
||||||
|
:prefix "SPC ,")
|
||||||
|
|
||||||
(leader
|
(leader
|
||||||
:infix "b"
|
:infix "b"
|
||||||
"d" #'kill-this-buffer))
|
"d" #'kill-this-buffer))
|
||||||
@@ -1146,7 +1153,7 @@ initial startup screen in default Emacs.
|
|||||||
** Calendar
|
** Calendar
|
||||||
Calendar is a simple inbuilt application within Emacs that helps with
|
Calendar is a simple inbuilt application within Emacs that helps with
|
||||||
date functionalities. I add functionality to copy dates from the
|
date functionalities. I add functionality to copy dates from the
|
||||||
calendar to the kill ring.
|
calendar to the kill ring and bind it to "Y".
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package calendar
|
(use-package calendar
|
||||||
:straight nil
|
:straight nil
|
||||||
@@ -1238,17 +1245,41 @@ are some corners I'd like to adjust).
|
|||||||
(use-package dired
|
(use-package dired
|
||||||
:straight nil
|
:straight nil
|
||||||
:hook (dired-mode-hook . dired-hide-details-mode)
|
:hook (dired-mode-hook . dired-hide-details-mode)
|
||||||
|
:init
|
||||||
|
(setq-default dired-listing-switches "-AFBl --group-directories-first --color")
|
||||||
:general
|
:general
|
||||||
(leader
|
(leader
|
||||||
:infix "d"
|
:infix "d"
|
||||||
"f" #'find-dired
|
"f" #'find-dired
|
||||||
"D" #'dired-other-frame
|
"D" #'dired-other-frame
|
||||||
"d" #'dired-jump)
|
"d" #'dired-jump)
|
||||||
:init
|
|
||||||
(setq-default dired-listing-switches "-AFBl --group-directories-first --color")
|
|
||||||
:config
|
:config
|
||||||
(with-eval-after-load "evil-collection"
|
(with-eval-after-load "evil-collection"
|
||||||
(evil-collection-dired-setup)))
|
(evil-collection-dired-setup))
|
||||||
|
(defun +dired/display-thumb-or-file ()
|
||||||
|
"If the file under point is a image file then display a
|
||||||
|
thumb, otherwise open the file."
|
||||||
|
(interactive)
|
||||||
|
(let* ((filename (dired-get-filename))
|
||||||
|
(ext (file-name-extension filename)))
|
||||||
|
(if (or (string= ext "png")
|
||||||
|
(string= ext "jpg")
|
||||||
|
(string= ext "jpeg")
|
||||||
|
(string= ext "gif"))
|
||||||
|
(image-dired-display-thumb)
|
||||||
|
(find-file-other-frame filename))))
|
||||||
|
|
||||||
|
(general-def
|
||||||
|
:states '(normal motion)
|
||||||
|
:keymaps 'dired-mode-map
|
||||||
|
"SPC" nil
|
||||||
|
"SPC ," nil)
|
||||||
|
|
||||||
|
(local-leader
|
||||||
|
:keymaps 'dired-mode-map
|
||||||
|
"l" #'dired-maybe-insert-subdir
|
||||||
|
"u" #'dired-undo
|
||||||
|
"i" #'+dired/display-thumb-or-file))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Xwidget
|
** Xwidget
|
||||||
*** Xwidget Preamble
|
*** Xwidget Preamble
|
||||||
@@ -1332,7 +1363,7 @@ pretty symbols to eshell.
|
|||||||
(use-package eshell
|
(use-package eshell
|
||||||
:commands +shell/toggle-shell
|
:commands +shell/toggle-shell
|
||||||
:display
|
:display
|
||||||
("\\*e?shell\\*"
|
("\\*e?shell\\*" ; for general shells as well
|
||||||
(display-buffer-at-bottom)
|
(display-buffer-at-bottom)
|
||||||
(window-height . 0.25))
|
(window-height . 0.25))
|
||||||
:pretty
|
:pretty
|
||||||
@@ -1352,9 +1383,14 @@ pretty symbols to eshell.
|
|||||||
(general-def
|
(general-def
|
||||||
:states '(insert normal)
|
:states '(insert normal)
|
||||||
:keymaps 'eshell-mode-map
|
:keymaps 'eshell-mode-map
|
||||||
"C-l" (proc (interactive) (eshell/clear-scrollback))
|
"M-l" (proc (interactive) (eshell/clear)
|
||||||
"C-j" #'eshell-next-matching-input-from-input
|
"M-j" #'eshell-next-matching-input-from-input
|
||||||
"C-k" #'eshell-previous-matching-input-from-input)))
|
"M-k" #'eshell-previous-matching-input-from-input)
|
||||||
|
(local-leader
|
||||||
|
:keymaps 'eshell-mode-map
|
||||||
|
"c" (proc (interactive) (eshell/clear)
|
||||||
|
(recenter))
|
||||||
|
"k" #'eshell-kill-process))))
|
||||||
:config
|
:config
|
||||||
(setq eshell-cmpl-ignore-case t
|
(setq eshell-cmpl-ignore-case t
|
||||||
eshell-cd-on-directory t
|
eshell-cd-on-directory t
|
||||||
|
|||||||
Reference in New Issue
Block a user