Optimizations

This commit is contained in:
Joseph Ferano 2022-08-28 20:08:51 +07:00
parent 8d928c9ccb
commit c00fb00276

View File

@ -129,6 +129,11 @@ need to benchmark slow init times later.
(global-auto-revert-mode t) ; Revert buffer's file when the file changes on disk
;; (setq confirm-kill-emacs 'y-or-n-p)
(require 'recentf)
(setq recentf-auto-cleanup 'never)
(setq recentf-keep '(file-remote-p file-readable-p))
#+end_src
Don't let emacs add customised settings to init.el, which in our case is worse since we have a
@ -173,7 +178,6 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering
#+begin_src emacs-lisp
(straight-use-package 'all-the-icons)
(straight-use-package 'dashboard)
(require 'dashboard)
(dashboard-setup-startup-hook)
(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")))
@ -328,8 +332,8 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
*** Popper
#+begin_src emacs-lisp
(require 'winner)
(winner-mode t)
(add-hook 'after-init-hook (lambda () (winner-mode t)))
(straight-use-package 'rotate)
(setq joe/popper-side-toggle 'right)
@ -435,8 +439,6 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
Vertico Embark Marginalia Consult Orderless
#+begin_src emacs-lisp
(require 'all-the-icons)
(straight-use-package 'all-the-icons-completion)
(straight-use-package '(vertico :files (:defaults "extensions/*") :includes (vertico-directory vertico-reverse)))
;; :bind (:map vertico-map
@ -548,8 +550,8 @@ Vertico Embark Marginalia Consult Orderless
(defun joe/dirvish-find-directory (dir)
(interactive "FDirvish Directory:")
(dirvish-dwim dir))
(straight-use-package 'magit)
(require 'magit)
(setq dirvish-quick-access-entries
'(("h" "~/" "Home")
("d" "~/Downloads/" "Downloads")
@ -613,10 +615,11 @@ Vertico Embark Marginalia Consult Orderless
** Undo Tree
#+begin_src emacs-lisp
(straight-use-package 'undo-tree)
(require 'undo-tree)
(global-undo-tree-mode)
(setq undo-tree-visualizer-diff t)
(setq undo-tree-history-directory-alist `(("." . ,(expand-file-name "undo" user-emacs-directory))))
(add-hook 'after-init-hook (lambda ()
(global-undo-tree-mode)
(setq undo-tree-visualizer-diff t)
(setq undo-tree-history-directory-alist `(("." . ,(expand-file-name "undo" user-emacs-directory))))))
#+end_src
** Which Key
@ -624,7 +627,7 @@ Vertico Embark Marginalia Consult Orderless
#+begin_src emacs-lisp
(straight-use-package 'which-key)
(setq which-key-idle-delay 0.3)
(which-key-mode)
(add-hook 'after-init-hook (lambda () (which-key-mode)))
#+end_src
** Text Editor
@ -652,7 +655,7 @@ Emacs is an great operating system, if only it had a good text editor...
*** Hydra
#+begin_src emacs-lisp
(straight-use-package 'hydra)
(require 'hydra)
(defhydra hydra-navigate (global-map "<f2>")
"Window Navigation"
("d" joe/smooth-scroll-half-page-down "half page down")
@ -817,7 +820,7 @@ Emacs is an great operating system, if only it had a good text editor...
(straight-use-package 'lsp-mode)
(setq lsp-keymap-prefix "C-c l")
;; (require 'lsp)
;; (straight-use-package 'eglot)
;; (setq completion-in-region-function (kind-icon-enhance-completion completion-in-region-function))
@ -829,18 +832,11 @@ Emacs is an great operating system, if only it had a good text editor...
;; (add-to-list 'completion-at-point-functions #'cape-symbol)
;; (add-to-list 'completion-at-point-functions #'cape-file)
;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
(straight-use-package 'kind-icon)
(require 'kind-icon)
;; (straight-use-package 'kind-icon)
;; (require 'kind-icon)
(straight-use-package 'company)
(require 'company)
(setq company-idle-delay 0
company-tooltip-idle-delay 10
company-require-match nil
company-frontends '(company-preview-frontend company-echo-metadata-frontend)
;; company-frontends '(company-text-icons-margin company-echo-metadata-frontend)
company-backends '((company-capf company-files)))
(setq company-transformers '(company-sort-by-occurrence))
;; (require 'company)
;; (setq company-transformers '())
(add-to-list 'completion-at-point-functions #'elisp-completion-at-point)
(with-eval-after-load 'company
@ -849,7 +845,14 @@ Emacs is an great operating system, if only it had a good text editor...
(define-key company-active-map (kbd "<return>") nil)
(define-key company-active-map (kbd "C-f") #'company-complete-selection)
(define-key company-active-map [tab] #'company-complete-common-or-cycle)
(define-key company-active-map (kbd "<backtab>") (lambda () (interactive) (company-complete-common-or-cycle -1))))
(define-key company-active-map (kbd "<backtab>") (lambda () (interactive) (company-complete-common-or-cycle -1)))
(setq company-idle-delay 0
company-tooltip-idle-delay 10
company-require-match nil
company-frontends '(company-preview-frontend company-echo-metadata-frontend)
;; company-frontends '(company-text-icons-margin company-echo-metadata-frontend)
company-backends '((company-capf company-files)))
(setq company-transformers '(company-sort-by-occurrence)))
(add-hook 'after-init-hook (lambda () (global-company-mode)))
;; (delete 'elisp-completion-at-point completion-at-point-functions)