Merge branch 'main' of tildegit.org:acdw/emacs
This commit is contained in:
commit
b777ba9f9e
109
init.el
109
init.el
|
@ -380,12 +380,13 @@ Most customizations must go in this function since `eshell' loads
|
|||
like a dumbass."
|
||||
;; Define keys
|
||||
(dolist (spec '(("C-d" . eshell-quit-or-delete-char)))
|
||||
(define-key eshell-mode-map (kbd (car spec)) (function (cdr spec))))
|
||||
(define-key eshell-mode-map (kbd (car spec)) (cdr spec)))
|
||||
;; Fix modeline
|
||||
(when (boundp 'simple-modeline--mode-line)
|
||||
(setq mode-line-format '(:eval simple-modeline--mode-line)))
|
||||
;; Set outline-regexp for consult-outline
|
||||
(setq outline-regexp eshell-prompt-regexp))
|
||||
;; Make navigating amongst prompts easier
|
||||
(setq-local outline-regexp eshell-prompt-regexp
|
||||
page-delimiter eshell-prompt-regexp))
|
||||
|
||||
(defun eshell-buffer-name ()
|
||||
(rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t))
|
||||
|
@ -528,6 +529,7 @@ like a dumbass."
|
|||
(add-hook 'prog-mode-hook #'goto-address-prog-mode))
|
||||
|
||||
(setup ibuffer
|
||||
(:also-load ibuf-ext)
|
||||
(:option ibuffer-saved-filter-groups
|
||||
'(("default"
|
||||
("dired" (mode . dired-mode))
|
||||
|
@ -564,11 +566,10 @@ like a dumbass."
|
|||
(interactive "P")
|
||||
(if arg (ibuffer) (electric-buffer-list nil))))
|
||||
|
||||
(add-hook 'ibuffer-mode
|
||||
(add-hook 'ibuffer-mode-hook
|
||||
(defun ibuffer@filter-to-default ()
|
||||
(ibuffer-switch-to-saved-filter-groups "default")))
|
||||
|
||||
(:also-load ibuf-ext)
|
||||
(:option ibuffer-show-empty-filter-groups nil
|
||||
ibuffer-expert t))
|
||||
|
||||
|
@ -696,7 +697,12 @@ like a dumbass."
|
|||
(recentf-mode +1))
|
||||
|
||||
(setup repeat
|
||||
;; new for Emacs 28!
|
||||
(:only-if (fboundp #'repeat-mode))
|
||||
|
||||
(:option repeat-exit-key "g"
|
||||
repeat-exit-timeout 5)
|
||||
|
||||
(repeat-mode +1))
|
||||
|
||||
(setup (:require savehist)
|
||||
|
@ -841,9 +847,69 @@ like a dumbass."
|
|||
(acdw/system :home)))
|
||||
recenter-positions '(top middle bottom))
|
||||
|
||||
(tooltip-mode -1)
|
||||
(tooltip-mode -1))
|
||||
|
||||
(setup winner
|
||||
;; see https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00888.html
|
||||
(:global "C-x 4 C-/" winner-undo
|
||||
"C-x 4 /" winner-undo
|
||||
"C-x 4 C-?" winner-redo
|
||||
"C-x 4 ?" winner-redo)
|
||||
|
||||
;; add `winner-undo' and `winner-redo' to `repeat-mode'
|
||||
(when (fboundp 'repeat-mode)
|
||||
(defvar winner-mode-repeat-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "/" #'winner-undo)
|
||||
(define-key map "?" #'winner-redo)
|
||||
map)
|
||||
"Keymap to repeat `winner-mode' sequences. Used in `repeat-mode'.")
|
||||
|
||||
(put 'winner-undo 'repeat-map 'winner-mode-repeat-map)
|
||||
(put 'winner-redo 'repeat-map 'winner-mode-repeat-map))
|
||||
|
||||
(winner-mode +1))
|
||||
|
||||
(setup windmove
|
||||
(:option windmove-wrap-around t)
|
||||
(:global
|
||||
;; moving
|
||||
"C-x 4 <left>" windmove-left
|
||||
"C-x 4 <right>" windmove-right
|
||||
"C-x 4 <up>" windmove-up
|
||||
"C-x 4 <down>" windmove-down
|
||||
;; swapping
|
||||
"C-x 4 S-<left>" windmove-swap-states-left
|
||||
"C-x 4 S-<right>" windmove-swap-states-right
|
||||
"C-x 4 S-<up>" windmove-swap-states-up
|
||||
"C-x 4 S-<down>" windmove-swap-states-down)
|
||||
|
||||
(when (fboundp 'repeat-mode)
|
||||
(defvar windmove-repeat-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
;; moving
|
||||
(define-key map [left] #'windmove-left)
|
||||
(define-key map [right] #'windmove-right)
|
||||
(define-key map [up] #'windmove-up)
|
||||
(define-key map [down] #'windmove-down)
|
||||
;; swapping
|
||||
(define-key map [S-left] #'windmove-swap-states-left)
|
||||
(define-key map [S-right] #'windmove-swap-states-right)
|
||||
(define-key map [S-up] #'windmove-swap-states-up)
|
||||
(define-key map [S-down] #'windmove-swap-states-down)
|
||||
map)
|
||||
"Keymap to repeat various `windmove' sequences. Used in `repeat-mode'.")
|
||||
|
||||
(dolist (sym '(windmove-left
|
||||
windmove-right
|
||||
windmove-up
|
||||
windmove-down
|
||||
windmove-swap-states-left
|
||||
windmove-swap-states-right
|
||||
windmove-swap-states-up
|
||||
windmove-swap-states-down))
|
||||
(put sym 'repeat-map 'windmove-repeat-map))))
|
||||
|
||||
(setup w32
|
||||
(:option w32-allow-system-shell t
|
||||
w32-pass-lwindow-to-system nil
|
||||
|
@ -1052,12 +1118,24 @@ like a dumbass."
|
|||
|
||||
(setup (:straight crux)
|
||||
|
||||
(:global "M-`" crux-other-window-or-switch-buffer
|
||||
(:global "C-x o" acdw/other-window-or-switch-buffer
|
||||
"C-o" crux-smart-open-line
|
||||
"M-o" crux-smart-open-line-above
|
||||
"C-M-\\" crux-cleanup-buffer-or-region
|
||||
"C-x 4 t" crux-transpose-windows)
|
||||
|
||||
(when (fboundp 'repeat-mode)
|
||||
(define-key other-window-repeat-map "o"
|
||||
#'acdw/other-window-or-switch-buffer)
|
||||
(define-key other-window-repeat-map "O"
|
||||
(defun acdw/other-window-or-switch-buffer-backward ()
|
||||
(interactive)
|
||||
(setq repeat-map 'other-window-repeat-map)
|
||||
(acdw/other-window-or-switch-buffer -1)))
|
||||
|
||||
(put 'acdw/other-window-or-switch-buffer
|
||||
'repeat-map 'other-window-repeat-map))
|
||||
|
||||
(crux-reopen-as-root-mode +1))
|
||||
|
||||
;; requires extension:
|
||||
|
@ -1223,14 +1301,15 @@ successive invocations."
|
|||
|
||||
(setup (:straight helpful)
|
||||
(:option helpful-max-buffers 5
|
||||
;;helpful-switch-buffer-function #'pop-to-buffer
|
||||
helpful-switch-buffer-function
|
||||
(lambda (buf)
|
||||
(pop-to-buffer buf
|
||||
'((display-buffer-reuse-mode-window
|
||||
display-buffer-pop-up-window)
|
||||
(mode . helpful-mode))
|
||||
:norecord)))
|
||||
helpful-switch-buffer-function #'pop-to-buffer
|
||||
;; helpful-switch-buffer-function
|
||||
;; (lambda (buf)
|
||||
;; (pop-to-buffer buf
|
||||
;; '((display-buffer-reuse-mode-window
|
||||
;; display-buffer-pop-up-window)
|
||||
;; (mode . helpful-mode))
|
||||
;; :norecord))
|
||||
)
|
||||
(:global "<help> f" helpful-callable
|
||||
"<help> v" helpful-variable
|
||||
"<help> k" helpful-key
|
||||
|
|
13
lisp/acdw.el
13
lisp/acdw.el
|
@ -566,5 +566,18 @@ It's called 'require-private' for historical reasons."
|
|||
(forward-sexp 2)
|
||||
('scan-error (end-of-buffer))))
|
||||
|
||||
|
||||
;;; Crux tweaks
|
||||
|
||||
;; `crux-other-window-or-switch-buffer' doesn't take an argument.
|
||||
(defun acdw/other-window-or-switch-buffer (&optional arg)
|
||||
"Call `other-window' or switch buffers, depending on window count."
|
||||
(interactive "P")
|
||||
(if (one-window-p)
|
||||
(switch-to-buffer nil)
|
||||
(other-window (or arg 1))))
|
||||
|
||||
|
||||
|
||||
(provide 'acdw)
|
||||
;;; acdw.el ends here
|
||||
|
|
Loading…
Reference in New Issue