EBR: save-place, winner, popper, rotate, consult keys, make keys

This commit is contained in:
Joseph Ferano 2022-08-25 00:02:59 +07:00
parent 3defc536df
commit e063675ec7
2 changed files with 91 additions and 37 deletions

View File

@ -73,10 +73,18 @@ Prioritize old byte-compiled source files over newer sources. It saves us a litt
nil t))) nil t)))
#+end_src #+end_src
*** UTF-8 Support *** UTF-8 Support
#+begin_src emacs-lisp :tangle ./early-init.el #+begin_src emacs-lisp :tangle ./early-init.el
(set-language-environment "UTF-8")
(setq default-input-method nil) (setq default-input-method nil)
(setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
(set-language-environment 'utf-8)
(set-keyboard-coding-system 'utf-8-mac) ; For old Carbon emacs on OS X only
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;;; early-init.el ends here ;;; early-init.el ends here
#+end_src #+end_src
@ -114,6 +122,7 @@ need to benchmark slow init times later.
#+end_src #+end_src
** Misc Stuff ** Misc Stuff
#+begin_SRC emacs-lisp #+begin_SRC emacs-lisp
(setq default-directory "/home/joe/") (setq default-directory "/home/joe/")
(setq vc-follow-symlinks t) ; Visit real file when editing a symlink without prompting. (setq vc-follow-symlinks t) ; Visit real file when editing a symlink without prompting.
@ -148,6 +157,7 @@ This avoids those annoying *#backup#* files that get added and eventually slow d
kept-old-versions 2 kept-old-versions 2
version-control t) version-control t)
#+END_SRC #+END_SRC
** Visuals ** Visuals
*** Dashboard *** Dashboard
@ -175,6 +185,7 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'olivetti) (straight-use-package 'olivetti)
(setq olivetti-minimum-body-width 100) (setq olivetti-minimum-body-width 100)
(global-set-key (kbd "C-x x o") 'olivetti-mode)
#+end_src #+end_src
*** Themes *** Themes
@ -202,6 +213,7 @@ Simple functions to remember the last chosen theme.
(buffer-string)))) (buffer-string))))
(mapc 'load-theme (cdr (car (read theme-data))))))) (mapc 'load-theme (cdr (car (read theme-data)))))))
#+end_src #+end_src
*** Other *** Other
Setup other stuff Setup other stuff
@ -225,14 +237,9 @@ Setup other stuff
(global-hl-line-mode +1) (global-hl-line-mode +1)
(column-number-mode +1) (column-number-mode +1)
;; (scroll-bar-mode -1)
;; (tool-bar-mode -1)
;; (menu-bar-mode -1)
;; (tooltip-mode -1)
(modify-all-frames-parameters (modify-all-frames-parameters
'((right-divider-width . 5) '((right-divider-width . 5)
(internal-border-width . 10))) (internal-border-width . 12)))
(setq inhibit-startup-screen t) (setq inhibit-startup-screen t)
@ -269,15 +276,18 @@ Setup other stuff
(add-hook 'ibuffer-mode-hook #'all-the-icons-ibuffer-mode) (add-hook 'ibuffer-mode-hook #'all-the-icons-ibuffer-mode)
(global-set-key [remap list-buffers] 'ibuffer) (global-set-key [remap list-buffers] 'ibuffer)
(global-set-key (kbd "C-x B") 'ibuffer) (global-set-key (kbd "C-x B") 'ibuffer)
(global-set-key (kbd "C-x C-b") 'consult-project-buffer) (global-set-key (kbd "C-x b") 'consult-project-buffer)
(global-set-key (kbd "C-x C-M-b") 'consult-buffer) (global-set-key (kbd "C-x C-b") 'consult-buffer)
(defun joe/switch-other-buffer () (defun joe/switch-other-buffer ()
"Switch to other buffer" "Switch to other buffer"
(interactive) (interactive)
(switch-to-buffer (other-buffer))) (switch-to-buffer (other-buffer)))
(global-set-key (kbd "C-x b") 'joe/switch-other-buffer) (global-set-key (kbd "C-x l") 'joe/switch-other-buffer)
(save-place-mode t)
(setq save-place-file (expand-file-name "places" user-emacs-directory))
#+end_src #+end_src
The theme of `C-x 4` bindings is that they operate on other windows, so this function matches that behavior. The theme of `C-x 4` bindings is that they operate on other windows, so this function matches that behavior.
@ -293,22 +303,49 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
#+end_src #+end_src
** Windows
#+begin_src emacs-lisp
(require 'winner)
(winner-mode t)
(straight-use-package 'rotate)
(straight-use-package 'popper)
(require 'popper)
(setq popper-reference-buffers
'("\\*compilation\\*" compilation-mode
"^\\*vterm\\*" vterm-mode))
(setq popper-window-height 0.35)
(popper-mode t)
(global-set-key (kbd "C-`") 'popper-toggle-latest)
(global-set-key (kbd "M-`") 'popper-cycle)
(global-set-key (kbd "C-M-`") 'popper-toggle-type)
(require 'popper-echo)
(popper-echo-mode t)
;; (setq popper-display-control nil)
;; (setq popper-display-function #'display-buffer-in-child-frame)
#+end_src
** Org Mode ** Org Mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'org-bullets) (straight-use-package 'org-bullets)
(eval-after-load 'org (lambda () (defun joe/org-init ()
(setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG"))) (setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG")))
(setq org-agenda-files '("~/todo.org")) (setq org-agenda-files '("~/todo.org"))
(require 'org-tempo) (require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(setq org-edit-src-content-indentation 0))) (setq org-edit-src-content-indentation 0))
(add-hook 'org-mode-hook (defun joe/org-hook () (with-eval-after-load 'org (joe/org-init))
(defun joe/org-hook ()
(local-set-key (kbd "C-. C-i") 'consult-outline)
(org-bullets-mode) (org-bullets-mode)
(org-indent-mode))) (org-indent-mode))
(add-hook 'org-mode-hook 'joe/org-hook)
#+end_src #+end_src
** VEMCO ** VEMCO
Vertico Embark Marginalia Consult Orderless Vertico Embark Marginalia Consult Orderless
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -361,12 +398,36 @@ Vertico Embark Marginalia Consult Orderless
(all-the-icons-completion-marginalia-setup) (all-the-icons-completion-marginalia-setup)
(add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup) (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
(straight-use-package 'consult)
(straight-use-package 'orderless) (straight-use-package 'orderless)
(setq completion-styles '(orderless basic) (setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles basic partial-completion)))) completion-category-overrides '((file (styles basic partial-completion))))
#+end_src #+end_src
*** Consult
#+begin_src emacs-lisp
(straight-use-package 'consult)
(global-set-key (kbd "C-. C-l") 'consult-line)
(global-set-key (kbd "C-. C-i") 'consult-imenu)
(global-set-key (kbd "C-. C-t") 'consult-theme)
(global-set-key (kbd "C-. C-r") 'consult-recent-file)
(global-set-key (kbd "C-. C-y") 'consult-yank-from-kill-ring)
#+end_src
** Avy
#+begin_src emacs-lisp
(straight-use-package 'avy)
(setq avy-case-fold-search nil) ;; case sensitive makes selection easier
(define-key global-map (kbd "C-;") 'avy-goto-char-2) ;; I use this most frequently
(define-key global-map (kbd "C-'") 'avy-goto-line) ;; Consistent with ivy-avy
(define-key global-map (kbd "M-g c") 'avy-goto-char)
(define-key global-map (kbd "M-g e") 'avy-goto-word-0) ;; lots of candidates
(define-key global-map (kbd "M-g g") 'avy-goto-line) ;; digits behave like goto-line
(define-key global-map (kbd "M-g w") 'avy-goto-word-1) ;; first character of the word
(define-key global-map (kbd "M-g P") 'avy-pop-mark)
#+end_src
** Helpful ** Helpful
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'helpful) (straight-use-package 'helpful)
@ -400,8 +461,8 @@ Vertico Embark Marginalia Consult Orderless
(interactive "FDirvish Directory:") (interactive "FDirvish Directory:")
(dirvish-dwim dir)) (dirvish-dwim dir))
(define-key global-map (kbd "C-x d") #'dirvish) (global-set-key (kbd "C-x d") #'dirvish)
(define-key global-map (kbd "C-x C-d") #'joe/dirvish-find-directory) (global-set-key (kbd "C-x C-d") #'joe/dirvish-find-directory)
#+end_src #+end_src
** Terminals/Shells ** Terminals/Shells
@ -411,11 +472,8 @@ Vertico Embark Marginalia Consult Orderless
(setq vterm-timer-delay 0.01) (setq vterm-timer-delay 0.01)
(setq vterm-buffer-name-string "VTerm - %s") (setq vterm-buffer-name-string "VTerm - %s")
(setq vterm-max-scrollback 100000) (setq vterm-max-scrollback 100000)
(straight-use-package 'multi-vterm)
(define-key global-map (kbd "C-c t v") #'vterm-other-window) (global-set-key (kbd "C-c t") #'vterm)
(define-key global-map (kbd "C-c t t") #'multi-vterm)
(define-key global-map (kbd "C-c t p") #'multi-vterm-prev)
(define-key global-map (kbd "C-c t n") #'multi-vterm-next)
(add-hook 'vterm-mode-hook (lambda () (setq-local global-hl-line-mode nil))) (add-hook 'vterm-mode-hook (lambda () (setq-local global-hl-line-mode nil)))
#+end_src #+end_src
@ -457,21 +515,6 @@ Emacs is an great operating system, if only it had a good text editor...
) )
#+end_src #+end_src
*** Avy
#+begin_src emacs-lisp
(straight-use-package 'avy)
(setq avy-case-fold-search nil) ;; case sensitive makes selection easier
(define-key global-map (kbd "C-;") 'avy-goto-char-2) ;; I use this most frequently
(define-key global-map (kbd "C-'") 'avy-goto-line) ;; Consistent with ivy-avy
(define-key global-map (kbd "M-g c") 'avy-goto-char)
(define-key global-map (kbd "M-g e") 'avy-goto-word-0) ;; lots of candidates
(define-key global-map (kbd "M-g g") 'avy-goto-line) ;; digits behave like goto-line
(define-key global-map (kbd "M-g w") 'avy-goto-word-1) ;; first character of the word
(define-key global-map (kbd "M-g (") 'avy-goto-open-paren)
(define-key global-map (kbd "M-g )") 'avy-goto-close-paren)
(define-key global-map (kbd "M-g P") 'avy-pop-mark)
#+end_src
*** Multiple Cursors *** Multiple Cursors
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'multiple-cursors) (straight-use-package 'multiple-cursors)
@ -615,8 +658,11 @@ Emacs is an great operating system, if only it had a good text editor...
(add-hook 'after-init-hook 'my/kakoune-setup) (add-hook 'after-init-hook 'my/kakoune-setup)
#+end_src #+end_src
** IDE Features ** IDE Features
*** C *** C
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; (straight-use-package 'yasnippet) ;; (straight-use-package 'yasnippet)
(straight-use-package 'markdown-mode) (straight-use-package 'markdown-mode)
@ -694,6 +740,12 @@ Emacs is an great operating system, if only it had a good text editor...
;; (yas-global-mode 1) ;; (yas-global-mode 1)
#+end_src #+end_src
*** Compilation
#+begin_src emacs-lisp
(global-set-key (kbd "C-x c r") (lambda () (interactive) (compile "make run")))
(global-set-key (kbd "C-x c c") (lambda () (interactive) (compile "make")))
#+end_src
** Magit ** Magit
The best git porcelain/client I've ever used The best git porcelain/client I've ever used
@ -703,6 +755,7 @@ The best git porcelain/client I've ever used
#+end_src #+end_src
** Restclient ** Restclient
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'restclient) (straight-use-package 'restclient)
#+end_src #+end_src

View File

@ -502,6 +502,7 @@ all of the evil keybindings in buffers like magit, without compromises."
;; (define-key evil-normal-state-map (kbd "[f") (lambda () ;; (define-key evil-normal-state-map (kbd "[f") (lambda ()
;; (interactive) ;; (interactive)
;; (evil-textobj-tree-sitter-goto-textobj "function.outer" t))) ;; (evil-textobj-tree-sitter-goto-textobj "function.outer" t)))
(setq display-buffer-alist (setq display-buffer-alist
`((,(rx bos `((,(rx bos
(| (literal "*compilation") (| (literal "*compilation")