mirror of
http://github.com/JaeUs3792/dotfiles
synced 2025-12-13 23:51:34 +09:00
Emacs : straight
This commit is contained in:
@ -6,11 +6,11 @@
|
||||
Emacs Configuration for emacs 29.50
|
||||
** Early Init
|
||||
#+begin_src emacs-lisp :tangle ~/.config/emacs/early-init.el
|
||||
;;; early-init.el -*- lexical-binding: t; -*-
|
||||
;; garbage collection
|
||||
(setq gc-cons-threshold (* 50 1024 1024)) ;; 50MB
|
||||
;; prefers newest version of a file
|
||||
(customize-set-variable 'load-prefer-newer t)
|
||||
;;; early-init.el -*- lexical-binding: t; -*-
|
||||
;; garbage collection
|
||||
(setq gc-cons-threshold (* 50 1024 1024)) ;; 50MB
|
||||
;; prefers newest version of a file
|
||||
(customize-set-variable 'load-prefer-newer t)
|
||||
|
||||
;;; Native compilation settings
|
||||
(when (featurep 'native-compile)
|
||||
@ -20,19 +20,19 @@ Emacs Configuration for emacs 29.50
|
||||
;; Make native compilation happens asynchronously
|
||||
(setq native-comp-deferred-compilation t))
|
||||
|
||||
(setq inhibit-startup-message t)
|
||||
(setq frame-resize-pixelwise t)
|
||||
(scroll-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(tooltip-mode -1)
|
||||
(set-fringe-mode 10)
|
||||
(menu-bar-mode -1)
|
||||
;;(blink-cursor-mode 0)
|
||||
(setq inhibit-startup-message t)
|
||||
(setq frame-resize-pixelwise t)
|
||||
(scroll-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(tooltip-mode -1)
|
||||
(set-fringe-mode 10)
|
||||
(menu-bar-mode -1)
|
||||
;;(blink-cursor-mode 0)
|
||||
|
||||
;; initial load with blue theme
|
||||
(load-theme 'deeper-blue)
|
||||
;; initial load with blue theme
|
||||
(load-theme 'deeper-blue)
|
||||
|
||||
(customize-set-variable 'initial-major-mode 'fundamental-mode)
|
||||
(customize-set-variable 'initial-major-mode 'fundamental-mode)
|
||||
|
||||
#+end_src
|
||||
** Init
|
||||
@ -46,28 +46,46 @@ Emacs Configuration for emacs 29.50
|
||||
#+end_src
|
||||
*** Package Function
|
||||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||||
(require 'package)
|
||||
(add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/"))
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
||||
(customize-set-variable 'package-archive-priorities
|
||||
'(("gnu" . 99) ; prefer GNU packages
|
||||
("nongnu" . 80) ; use non-gnu packages if
|
||||
; not found in GNU elpa
|
||||
("stable" . 70) ; prefer "released" versions
|
||||
; from melpa
|
||||
("melpa" . 0))) ; if all else fails, get it
|
||||
; from melpa
|
||||
(defvar bootstrap-version)
|
||||
(defvar comp-deferred-compilation-deny-list ()) ; workaround, otherwise straight shits itself
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
|
||||
(bootstrap-version 5))
|
||||
(unless (file-exists-p bootstrap-file)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
|
||||
'silent 'inhibit-cookies)
|
||||
(goto-char (point-max))
|
||||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
(straight-use-package '(use-package :build t))
|
||||
(setq use-package-always-ensure t)
|
||||
;;(require 'package)
|
||||
;;(add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/"))
|
||||
;;(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
||||
;;(customize-set-variable 'package-archive-priorities
|
||||
;; '(("gnu" . 99) ; prefer GNU packages
|
||||
;; ("nongnu" . 80) ; use non-gnu packages if
|
||||
;; ; not found in GNU elpa
|
||||
;; ("stable" . 70) ; prefer "released" versions
|
||||
;; ; from melpa
|
||||
;; ("melpa" . 0))) ; if all else fails, get it
|
||||
;; ; from melpa
|
||||
;; make sure the elpa/ folder exists after setting it above.
|
||||
;;(defmacro usr-package-install (package)
|
||||
;; `(unless (package-installed-p ,package) (package-install ,package)))
|
||||
;;(package-initialize)
|
||||
;;(if (version< emacs-version "29")
|
||||
;; (usr-package-install 'use-package)) ;; <emacs29
|
||||
(unless (file-exists-p package-user-dir)
|
||||
(mkdir package-user-dir t))
|
||||
|
||||
(defmacro usr-package-install (package)
|
||||
`(unless (package-installed-p ,package) (package-install ,package)))
|
||||
(package-initialize)
|
||||
|
||||
(if (version< emacs-version "29")
|
||||
(usr-package-install 'use-package)) ;; <emacs29
|
||||
;;; init.el ends here
|
||||
;;; init.el ends here
|
||||
#+end_src
|
||||
*** Add other modules
|
||||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||||
@ -150,6 +168,10 @@ Emacs Configuration for emacs 29.50
|
||||
|
||||
(setq default-input-method "korean-hangul")
|
||||
|
||||
;; when programming _
|
||||
(modify-syntax-entry ?_ "w")
|
||||
(setq visible-bell t)
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(custom-set-faces
|
||||
@ -162,12 +184,12 @@ Emacs Configuration for emacs 29.50
|
||||
(require 'custom-keybindings)
|
||||
(require 'custom-default)
|
||||
(require 'custom-completion)
|
||||
(require 'custom-projects)
|
||||
(require 'custom-latex)
|
||||
(require 'custom-org)
|
||||
;;(require 'custom-projects)
|
||||
;;(require 'custom-latex)
|
||||
;;(require 'custom-org)
|
||||
;;(require 'custom-workspaces)
|
||||
(require 'custom-languages)
|
||||
(require 'custom-extra)
|
||||
;;(require 'custom-languages)
|
||||
;;(require 'custom-extra)
|
||||
|
||||
;;; config.el ends here
|
||||
#+end_src
|
||||
@ -240,55 +262,73 @@ emacs built-in package config
|
||||
#+end_src
|
||||
**** Dired
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-default.el
|
||||
(usr-package-install 'dired-single)
|
||||
(usr-package-install 'diredfl) ;; colorful dired
|
||||
(usr-package-install 'dired-git-info)
|
||||
(usr-package-install 'diff-hl) ;; diff highlight
|
||||
(usr-package-install 'dired-rsync)
|
||||
(usr-package-install 'all-the-icons-dired)
|
||||
(usr-package-install 'dired-hide-dotfiles)
|
||||
(usr-package-install 'peep-dired)
|
||||
;; dired default
|
||||
(setq dired-listing-switches "-agho --group-directories-first")
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
"h" 'dired-up-directory ;dired-single-up-directory
|
||||
"l" 'dired-find-file) ;dired-single-buffer)
|
||||
;;(require 'dired-single)
|
||||
;;(use-package dired-single
|
||||
;; :commands (dired dired-jump))
|
||||
;; colorful
|
||||
(add-hook 'dired-mode-hook #'diredfl-mode)
|
||||
;; git info
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
")" 'dired-git-info-mode)
|
||||
;; diff highlight
|
||||
(add-hook 'dired-mode-hook #'diff-hl-dired-mode-unless-remote)
|
||||
(add-hook 'magit-post-refresh-hook #'diff-hl-dired-mode-unless-remote)
|
||||
(diff-hl-margin-mode)
|
||||
;; rsync
|
||||
(bind-key "C-c C-r" 'dired-rsync dired-mode-map)
|
||||
;; all-the icons
|
||||
(add-hook 'dired-mode-hook #'all-the-icons-dired-mode)
|
||||
(use-package dired
|
||||
:ensure nil
|
||||
:straight nil
|
||||
:commands (dired dired-jump)
|
||||
:bind (("C-x C-j" . dired-jump))
|
||||
:custom ((dired-listing-switches "-agho --group-directories-first"))
|
||||
:config
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
"h" 'dired-up-directory ;dired-single-up-directory
|
||||
"l" 'dired-find-file)) ;dired-single-buffer)
|
||||
(use-package dired-single
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:commands (dired dired-jump))
|
||||
(use-package diredfl ;; colorful dired
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook dired-mode)
|
||||
(use-package dired-git-info
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:config
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
")" 'dired-git-info-mode))
|
||||
(use-package diff-hl
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook ((dired-mode-hook . diff-hl-dired-mode-unless-remote)
|
||||
(magit-post-refresh-hook . diff-hl-magit-post-refresh))
|
||||
:config
|
||||
(diff-hl-margin-mode))
|
||||
(use-package dired-rsync
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:config
|
||||
(bind-key "C-c C-r" 'dired-rsync dired-mode-map))
|
||||
(use-package all-the-icons-dired
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook dired-mode)
|
||||
(use-package dired-hide-dotfiles
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (dired-mode)
|
||||
:config
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
"H" 'dired-hide-dotfiles-mode))
|
||||
|
||||
;;(usr-package-install 'peep-dired)
|
||||
;; HACK:Fixes #1929: icons break file renaming in Emacs 27+, because the icon
|
||||
;; is considered part of the filename, so we disable icons while we're in
|
||||
;; wdired-mode.
|
||||
;;(when EMACS27+
|
||||
(defvar +wdired-icons-enabled -1)
|
||||
|
||||
;; hide dotfiles
|
||||
(add-hook 'dired-mode-hook #'dired-hide-dotfiles-mode)
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
"H" 'dired-hide-dotfiles-mode)
|
||||
|
||||
;; TODO: check emacs29 updates
|
||||
;;(csetq dired-mouse-drag-files t
|
||||
;; mouse-drag-and-drop-region-cross-program t)
|
||||
|
||||
; peep dired
|
||||
(evil-define-key 'normal peep-dired-mode-map
|
||||
(kbd "j") 'peep-dired-next-file
|
||||
(kbd "k") 'peep-dired-prev-file)
|
||||
(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
|
||||
(use-package peep-dired
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (peep-dired-hook . evil-normalize-keymaps)
|
||||
:config
|
||||
(evil-define-key 'normal peep-dired-mode-map
|
||||
(kbd "j") 'peep-dired-next-file
|
||||
(kbd "k") 'peep-dired-prev-file))
|
||||
#+end_src
|
||||
**** Provide Modules
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-default.el
|
||||
@ -311,18 +351,21 @@ emacs built-in package config
|
||||
|
||||
**** Doom themes
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
(usr-package-install 'doom-themes)
|
||||
(require 'doom-themes)
|
||||
(disable-theme 'deeper-blue)
|
||||
(if (display-graphic-p)
|
||||
(load-theme 'doom-palenight t)
|
||||
(load-theme 'doom-gruvbox t))
|
||||
(use-package doom-themes
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init
|
||||
(disable-theme 'deeper-blue)
|
||||
(if (display-graphic-p)
|
||||
(load-theme 'doom-palenight t)
|
||||
(load-theme 'doom-gruvbox t)))
|
||||
#+end_src
|
||||
**** Rainbow Delimiters
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
(usr-package-install 'rainbow-delimiters)
|
||||
(require 'rainbow-delimiters)
|
||||
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
|
||||
(use-package rainbow-delimiters
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
#+end_src
|
||||
**** Setting Transparency
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
@ -362,79 +405,85 @@ emacs built-in package config
|
||||
#+end_src
|
||||
**** Modeline
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
(usr-package-install 'doom-modeline)
|
||||
(require 'doom-modeline)
|
||||
(setq doom-modeline-height 15
|
||||
doom-modeline-env-version t
|
||||
doom-modeline-persp-name t
|
||||
doom-modeline-persp-icon t
|
||||
doom-modeline-display-default-persp-name t
|
||||
doom-modeline-indent-info t)
|
||||
(doom-modeline-mode 1)
|
||||
(use-package doom-modeline
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (doom-modeline-mode 1)
|
||||
:config
|
||||
(setq doom-modeline-height 15
|
||||
doom-modeline-env-version t
|
||||
doom-modeline-persp-name t
|
||||
doom-modeline-persp-icon t
|
||||
doom-modeline-display-default-persp-name t
|
||||
doom-modeline-indent-info t))
|
||||
#+end_src
|
||||
**** Visual Fill Column
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
(usr-package-install 'visual-fill-column)
|
||||
(require 'visual-fill-column)
|
||||
(defun write-room-enable ()
|
||||
"Write Room Enable"
|
||||
(interactive)
|
||||
(setq visual-fill-column-width 100
|
||||
visual-fill-column-center-text t)
|
||||
(visual-fill-column-mode 1))
|
||||
(add-hook 'org-mode-hook #'write-room-enable)
|
||||
(add-hook 'markdown-mode-hook #'write-room-enable)
|
||||
(add-hook 'nov-mode-hook #'write-room-enable)
|
||||
#+end_src
|
||||
(visual-fill-column-mode t))
|
||||
|
||||
(use-package visual-fill-column
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook ((org-mode markdown-mode nov-mode) . write-room-enable))
|
||||
#+end_src
|
||||
**** All The Icons
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
(use-package all-the-icons
|
||||
:straight t)
|
||||
#+end_src
|
||||
**** Dashboard
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
(usr-package-install 'dashboard)
|
||||
(require 'linum) ;; for dashboard seperator
|
||||
;;(add-hook 'dashboard-mode page-break-lines-mode)
|
||||
(require 'dashboard)
|
||||
(use-package dashboard
|
||||
:straight (:build t)
|
||||
:ensure t
|
||||
:after all-the-icons
|
||||
:config
|
||||
(setq dashboard-set-heading-icons t)
|
||||
(setq dashboard-set-file-icons t)
|
||||
;;(setq dashboard-banner-logo-title "Emacs is more than a text editor!")
|
||||
;;(setq dashboard-startup-banner 'logo)
|
||||
(setq dashboard-center-content t)
|
||||
(setq dashboard-week-agenda t)
|
||||
(setq dashboard-set-footer t)
|
||||
(setq dashboard-page-separator "\n\n")
|
||||
;;(setq dashboard-page-separator "\n\f\n")
|
||||
(setq dashboard-agenda-time-string-format "%d/%m/%Y %A %H:%M")
|
||||
(setq dashboard-items '((recents . 10)
|
||||
(agenda . 5)
|
||||
(bookmarks . 5)
|
||||
;;(if (version< emacs-version "29")
|
||||
;; (projects . 5))
|
||||
(registers . 5)))
|
||||
(setq dashboard-set-navigator t)
|
||||
|
||||
(setq dashboard-set-heading-icons t)
|
||||
(setq dashboard-set-file-icons t)
|
||||
;;(setq dashboard-banner-logo-title "Emacs is more than a text editor!")
|
||||
;;(setq dashboard-startup-banner 'logo)
|
||||
(setq dashboard-center-content t)
|
||||
(setq dashboard-week-agenda t)
|
||||
(setq dashboard-set-footer t)
|
||||
(setq dashboard-page-separator "\n\f\n")
|
||||
(setq dashboard-agenda-time-string-format "%d/%m/%Y %A %H:%M")
|
||||
(setq dashboard-items '((recents . 10)
|
||||
(agenda . 5)
|
||||
(bookmarks . 5)
|
||||
;;(if (version< emacs-version "29")
|
||||
;; (projects . 5))
|
||||
(registers . 5)))
|
||||
(setq dashboard-set-navigator t)
|
||||
|
||||
(setq dashboard-navigator-buttons
|
||||
`(;; line1
|
||||
((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
|
||||
"Github"
|
||||
"Browse my Github"
|
||||
(lambda (&rest _) (browse-url "https://github.com/JaeUs3792/")))
|
||||
(,(all-the-icons-octicon "home" :height 1.1 :v-adjust 0.0)
|
||||
"Homepage"
|
||||
"Browse my Homepage"
|
||||
(lambda (&rest _) (browse-url "https://jaeus.net")))
|
||||
(,(all-the-icons-octicon "zap" :height 1.1 :v-adjust 0.0)
|
||||
"Refresh"
|
||||
"Refresh Packages"
|
||||
(lambda (&rest _) (package-refresh-contents)) warning))))
|
||||
|
||||
(dashboard-setup-startup-hook)
|
||||
(dashboard-modify-heading-icons '((recents . "file-text")
|
||||
(bookmarks . "book")))
|
||||
(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")))
|
||||
(setq dashboard-navigator-buttons
|
||||
`(;; line1
|
||||
((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
|
||||
"Github"
|
||||
"Browse my Github"
|
||||
(lambda (&rest _) (browse-url "https://github.com/JaeUs3792/")))
|
||||
(,(all-the-icons-octicon "home" :height 1.1 :v-adjust 0.0)
|
||||
"Homepage"
|
||||
"Browse my Homepage"
|
||||
(lambda (&rest _) (browse-url "https://jaeus.net")))
|
||||
(,(all-the-icons-octicon "zap" :height 1.1 :v-adjust 0.0)
|
||||
"Refresh"
|
||||
"Refresh Packages"
|
||||
(lambda (&rest _) (package-refresh-contents)) warning))))
|
||||
|
||||
(dashboard-setup-startup-hook)
|
||||
(dashboard-modify-heading-icons '((recents . "file-text")
|
||||
(bookmarks . "book")))
|
||||
(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))))
|
||||
#+end_src
|
||||
|
||||
**** Others
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||||
(usr-package-install 'all-the-icons)
|
||||
(setq visible-bell t)
|
||||
(defun my/self-screenshot (&optional type)
|
||||
"Save a screenshot of type TYPE of the current Emacs frame.
|
||||
As shown by the function `', type can weild the value `svg',
|
||||
@ -480,22 +529,28 @@ emacs built-in package config
|
||||
**** Which keys
|
||||
When you begin a keybind, whichkey will show you all keybinds you can follow the first one with in order to form a full keywords.
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||||
(usr-package-install 'which-key)
|
||||
(require 'which-key)
|
||||
(setq which-key-idle-delay 0.5)
|
||||
(which-key-mode 1)
|
||||
(use-package which-key
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (which-key-mode)
|
||||
:diminish which-key-mode
|
||||
:config
|
||||
(setq which-key-idle-delay 0.5))
|
||||
#+end_src
|
||||
**** General
|
||||
for managing keybindings.
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||||
(usr-package-install 'general)
|
||||
(require 'general)
|
||||
(general-auto-unbind-keys)
|
||||
(general-evil-setup t)
|
||||
(general-create-definer ju/leader-key-def
|
||||
:keymaps '(normal insert visual emacs)
|
||||
:prefix "SPC"
|
||||
:global-prefix "C-SPC")
|
||||
(use-package general
|
||||
:straight (:build t)
|
||||
:init
|
||||
(general-auto-unbind-keys)
|
||||
:config
|
||||
(general-evil-setup t)
|
||||
(general-create-definer ju/leader-key-def
|
||||
:keymaps '(normal insert visual emacs)
|
||||
:prefix "SPC"
|
||||
:global-prefix "C-SPC"))
|
||||
|
||||
(ju/leader-key-def
|
||||
"." 'find-file
|
||||
;; Buffer
|
||||
@ -528,7 +583,6 @@ for managing keybindings.
|
||||
"o a" '(:ignore t :which-key "org agenda")
|
||||
"o a c" '((lambda () (interactive) (find-file (expand-file-name "agenda/agenda.org" org-directory))) :which-key "org agenda file")
|
||||
"o c" '(cfw:open-org-calendar :which-key "org calendar")
|
||||
|
||||
;; Project-el
|
||||
"p" '(:ignore t :which-key "project")
|
||||
"p ." '(project-switch-project :which-key "switch project")
|
||||
@ -547,69 +601,83 @@ for managing keybindings.
|
||||
#+end_src
|
||||
**** Evil Mode
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||||
(usr-package-install 'evil)
|
||||
(usr-package-install 'evil-collection)
|
||||
(usr-package-install 'evil-nerd-commenter)
|
||||
(usr-package-install 'evil-numbers)
|
||||
(customize-set-variable 'evil-want-integration t)
|
||||
(customize-set-variable 'evil-want-keybinding nil)
|
||||
(customize-set-variable 'evil-want-C-u-scroll t)
|
||||
(customize-set-variable 'evil-want-C-i-jump nil)
|
||||
(customize-set-variable 'evil-respect-visual-line-mode nil) ; t : on the screen, nil : by cr characters
|
||||
(use-package evil
|
||||
:straight (:build t)
|
||||
:after general
|
||||
:init
|
||||
(setq evil-want-integration t
|
||||
evil-want-keybinding nil
|
||||
evil-want-C-u-scroll t
|
||||
evil-want-C-i-jump nil)
|
||||
;;(setq evil-respect-visual-line-mode nil) ; t : on the screen, nil : by cr characters
|
||||
(require 'evil-vars)
|
||||
(evil-set-undo-system 'undo-tree)
|
||||
;;(evil-set-undo-system 'undo-redo)
|
||||
|
||||
(customize-set-variable 'evil-set-fine-undo t); more granular undo with evil
|
||||
;; Make evil search more like vim (makes emacs slow)
|
||||
;;(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
|
||||
(require 'evil)
|
||||
(evil-mode 1)
|
||||
;; Make evil search more like vim
|
||||
;;(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
:config
|
||||
(evil-mode 1)
|
||||
(setq evil-want-fine-undo t) ; more granular undo with evil
|
||||
(evil-set-initial-state 'messages-buffer-mode 'normal)
|
||||
(evil-set-initial-state 'dashboard-mode 'normal)
|
||||
;; eshell no evil
|
||||
(dolist (mode '(eshell-mode))
|
||||
(add-to-list 'evil-emacs-state-modes mode)))
|
||||
|
||||
(evil-set-undo-system 'undo-tree)
|
||||
;;(evil-set-undo-system 'undo-redo)
|
||||
(evil-set-initial-state 'messages-buffer-mode 'normal)
|
||||
(evil-set-initial-state 'dashboard-mode 'normal)
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:straight (:build t)
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
;; evil nerd commenter
|
||||
(define-key evil-normal-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines)
|
||||
(define-key evil-visual-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines)
|
||||
(use-package evil-nerd-commenter
|
||||
:after evil
|
||||
:straight (:build t)
|
||||
:config
|
||||
;; evil nerd commenter
|
||||
(define-key evil-normal-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines)
|
||||
(define-key evil-visual-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines))
|
||||
|
||||
;; evil collection
|
||||
(evil-collection-init)
|
||||
(use-package evil-numbers
|
||||
:after evil
|
||||
:straight (:build t)
|
||||
:config
|
||||
;; evil numbers
|
||||
;; unfortunately C-x is emacs common key binding.
|
||||
(define-key evil-normal-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
|
||||
(define-key evil-normal-state-map (kbd "g -") 'evil-numbers/dec-at-pt)
|
||||
(define-key evil-visual-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
|
||||
(define-key evil-visual-state-map (kbd "g -") 'evil-numbers/dec-at-pt))
|
||||
|
||||
;; evil numbers
|
||||
;; unfortunately C-x is emacs common key binding.
|
||||
(define-key evil-normal-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
|
||||
(define-key evil-normal-state-map (kbd "g -") 'evil-numbers/dec-at-pt)
|
||||
(define-key evil-visual-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
|
||||
(define-key evil-visual-state-map (kbd "g -") 'evil-numbers/dec-at-pt)
|
||||
|
||||
;; eshell no evil
|
||||
(dolist (mode '(eshell-mode))
|
||||
(add-to-list 'evil-emacs-state-modes mode))
|
||||
|
||||
;; when programming _
|
||||
(modify-syntax-entry ?_ "w")
|
||||
#+end_src
|
||||
**** Undo Tree
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||||
(usr-package-install 'undo-tree)
|
||||
(require 'undo-tree)
|
||||
(setq undo-tree-visualizer-diff t
|
||||
undo-tree-visualizer-timestamps t
|
||||
undo-tree-auto-save-history t
|
||||
undo-tree-enable-undo-in-region t
|
||||
undo-limit (* 800 1024)
|
||||
undo-strong-limit (* 12 1024 1024)
|
||||
undo-outer-limit (* 128 1024 1024))
|
||||
(setq undo-tree-history-directory-alist
|
||||
`(("." . ,(expand-file-name (file-name-as-directory "undo-tree-hist")
|
||||
user-emacs-directory))))
|
||||
(global-undo-tree-mode)
|
||||
(use-package undo-tree
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:custom
|
||||
(undo-tree-history-directory-alist
|
||||
`(("." . ,(expand-file-name (file-name-as-directory "undo-tree-hist")
|
||||
user-emacs-directory))))
|
||||
:init
|
||||
(global-undo-tree-mode)
|
||||
:config
|
||||
(setq undo-tree-visualizer-diff t
|
||||
undo-tree-visualizer-timestamps t
|
||||
undo-tree-auto-save-history t
|
||||
undo-tree-enable-undo-in-region t
|
||||
undo-limit (* 800 1024)
|
||||
undo-strong-limit (* 12 1024 1024)
|
||||
undo-outer-limit (* 128 1024 1024)))
|
||||
#+end_src
|
||||
**** Hydra
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||||
(usr-package-install 'hydra)
|
||||
(require 'hydra)
|
||||
(use-package hydra
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
(defhydra hydra-text-scale (:timeout 4)
|
||||
"scale text"
|
||||
("t" text-scale-increase "in")
|
||||
@ -644,82 +712,115 @@ config from crafted-emacs
|
||||
https://github.com/SystemCrafters/crafted-emacs
|
||||
**** Vertico
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
(usr-package-install 'vertico)
|
||||
(require 'vertico)
|
||||
(require 'vertico-directory)
|
||||
(with-eval-after-load 'evil
|
||||
(define-key vertico-map (kbd "C-j") 'vertico-next)
|
||||
(define-key vertico-map (kbd "C-k") 'vertico-previous)
|
||||
(define-key vertico-map (kbd "M-h") 'vertico-directory-up))
|
||||
(customize-set-variable 'vertico-cycle t)
|
||||
(vertico-mode 1)
|
||||
(use-package vertico
|
||||
:straight (:build t)
|
||||
:bind (:map vertico-map
|
||||
("C-j" . vertico-next)
|
||||
("C-k" . vertico-previous))
|
||||
:custom
|
||||
(vertico-cycle t)
|
||||
:init
|
||||
(vertico-mode))
|
||||
;;(use-package vertico
|
||||
;; :straight (:build t)
|
||||
;; :ensure t
|
||||
;; :bind (:map vertico-map
|
||||
;; ("C-j" 'vertico-next)
|
||||
;; ("C-k" 'vertico-previous)
|
||||
;; ("M-h" 'vertico-directory-up))
|
||||
;; :custom
|
||||
;; (vertico-cycle t)
|
||||
;; :config
|
||||
;; (vertico-mode))
|
||||
#+end_src
|
||||
**** Prescient
|
||||
simple but effective sorting and filtering for emacs.
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
(usr-package-install 'vertico-prescient)
|
||||
(vertico-prescient-mode)
|
||||
(use-package vertico-prescient
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:config
|
||||
(vertico-prescient-mode))
|
||||
#+end_src
|
||||
**** Marginalia
|
||||
annotations placed at the margin of the minibuffer
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
(usr-package-install 'marginalia)
|
||||
(require 'marginalia)
|
||||
(customize-set-variable 'marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
|
||||
(marginalia-mode 1)
|
||||
(use-package vertico-prescient
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:custom (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
|
||||
:config (marginalia-mode 1))
|
||||
#+end_src
|
||||
**** Consult
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
(usr-package-install 'consult)
|
||||
(global-set-key (kbd "C-s") 'consult-line)
|
||||
(define-key minibuffer-local-map (kbd "C-r") 'consult-history)
|
||||
(global-set-key (kbd "C-M-j") 'consult-buffer)
|
||||
(setq completion-in-region-function #'consult-completion-in-region)
|
||||
(use-package consult
|
||||
:straight (:build t)
|
||||
:demand t
|
||||
:bind (:map minibuffer-local-map
|
||||
("C-r" . consult-history))
|
||||
:custom
|
||||
(completion-in-region-function #'consult-completion-in-region)
|
||||
:config
|
||||
(global-set-key (kbd "C-s") 'consult-line)
|
||||
(global-set-key (kbd "C-M-j") 'consult-buffer))
|
||||
#+end_src
|
||||
**** Orderless
|
||||
orderless completion
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
(usr-package-install 'orderless)
|
||||
(require 'orderless)
|
||||
(customize-set-variable 'completion-styles '(orderless basic))
|
||||
(customize-set-variable 'completion-category-overrides '((file (style basic partial-completion))))
|
||||
(use-package orderless
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:custom
|
||||
(completion-styles '(orderless basic))
|
||||
(completion-category-overrides '((file (style basic partial-completion)))))
|
||||
#+end_src
|
||||
**** Embark / Embark Consult
|
||||
Quick Action in minibuffer
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
(usr-package-install 'embark)
|
||||
(usr-package-install 'embark-consult)
|
||||
(require 'embark)
|
||||
(require 'embark-consult)
|
||||
(global-set-key [remap describe-bindings] #'embark-bindings)
|
||||
(global-set-key (kbd "C-.") 'embark-act)
|
||||
;; Use Embark to show bindings in a key prefix with `C-h`
|
||||
(setq prefix-help-command #'embark-prefix-help-command)
|
||||
(with-eval-after-load 'embark-consult
|
||||
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
|
||||
(use-package embark
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:bind (("C-." . embark-act))
|
||||
:config
|
||||
(with-eval-after-load 'embark-consult
|
||||
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
|
||||
(global-set-key [remap describe-bindings] #'embark-bindings)
|
||||
;; Use Embark to show bindings in a key prefix with `C-h`
|
||||
(setq prefix-help-command #'embark-prefix-help-command))
|
||||
|
||||
(use-package embark-consult
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:after embark)
|
||||
#+end_src
|
||||
|
||||
**** Corfu / Cape
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
(usr-package-install 'corfu)
|
||||
(usr-package-install 'corfu-terminal)
|
||||
(usr-package-install 'cape)
|
||||
;;; Corfu
|
||||
;;; Corfu
|
||||
(use-package corfu
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:custom
|
||||
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
|
||||
(corfu-auto t) ;; Enable auto completion
|
||||
(corfu-auto-prefix 2)
|
||||
(corfu-auto-delay 0.0)
|
||||
(corfu-echo-documentation 0.25)
|
||||
;; (corfu-separator ?\s) ;; Orderless field separator
|
||||
;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
|
||||
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
|
||||
;; (corfu-preview-current nil) ;; Disable current candidate preview
|
||||
;; (corfu-preselect 'prompt) ;; Preselect the prompt
|
||||
;; (corfu-on-exact-match nil) ;; Configure handling of exact matches
|
||||
;; (corfu-scroll-margin 5) ;; Use scroll margin
|
||||
:init
|
||||
(global-corfu-mode))
|
||||
|
||||
;; load extension
|
||||
(add-to-list 'load-path
|
||||
(expand-file-name "straight/build/corfu/extensions"
|
||||
straight-base-dir))
|
||||
(require 'corfu-popupinfo)
|
||||
(require 'corfu)
|
||||
|
||||
(unless (display-graphic-p)
|
||||
(require 'corfu-terminal)
|
||||
(corfu-terminal-mode +1))
|
||||
|
||||
;; Setup corfu for popup like completion
|
||||
(customize-set-variable 'corfu-cycle t) ; Allows cycling through candidates
|
||||
(customize-set-variable 'corfu-auto t) ; Enable auto completion
|
||||
(customize-set-variable 'corfu-auto-prefix 2) ; Complete with less prefix keys
|
||||
(customize-set-variable 'corfu-auto-delay 0.0) ; No delay for completion
|
||||
(customize-set-variable 'corfu-echo-documentation 0.25) ; Echo docs for current completion option
|
||||
|
||||
(global-corfu-mode 1)
|
||||
(corfu-popupinfo-mode 1)
|
||||
(eldoc-add-command #'corfu-insert)
|
||||
(define-key corfu-map (kbd "M-p") #'corfu-popupinfo-scroll-down)
|
||||
@ -727,26 +828,28 @@ Quick Action in minibuffer
|
||||
(define-key corfu-map (kbd "M-d") #'corfu-popupinfo-toggle)
|
||||
|
||||
;;; Cape
|
||||
|
||||
;; Setup Cape for better completion-at-point support and more
|
||||
(require 'cape)
|
||||
|
||||
;; Add useful defaults completion sources from cape
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||
|
||||
;; Silence the pcomplete capf, no errors or messages!
|
||||
;; Important for corfu
|
||||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
|
||||
|
||||
;; Ensure that pcomplete does not write to the buffer
|
||||
;; and behaves as a pure `completion-at-point-function'.
|
||||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
|
||||
(add-hook 'eshell-mode-hook
|
||||
(lambda () (setq-local corfu-quit-at-boundary t
|
||||
corfu-quit-no-match t
|
||||
corfu-auto nil)
|
||||
(corfu-mode)))
|
||||
(use-package cape
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:config
|
||||
;; Add useful defaults completion sources from cape
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||
;; Silence the pcomplete capf, no errors or messages!
|
||||
;; Important for corfu
|
||||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
|
||||
;; Ensure that pcomplete does not write to the buffer
|
||||
;; and behaves as a pure `completion-at-point-function'.
|
||||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
|
||||
(add-hook 'eshell-mode-hook
|
||||
(lambda () (setq-local corfu-quit-at-boundary t
|
||||
corfu-quit-no-match t
|
||||
corfu-auto nil)
|
||||
(corfu-mode))))
|
||||
(unless (display-graphic-p)
|
||||
(require 'corfu-terminal)
|
||||
(corfu-terminal-mode +1))
|
||||
#+end_src
|
||||
**** Provide Modules
|
||||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||||
|
||||
Reference in New Issue
Block a user