mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 16:53:00 +00:00
feat(emacs): evil, appearance and edit
* evil: Text Object (l -> inner) and Evil-Surround * appearance: mode line (doom) and bufferline (built-in) * edit: vertico and marginalia
This commit is contained in:
parent
ffcc8fb768
commit
e6b1e1b595
8 changed files with 99 additions and 21 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
;; Your init file should contain only one such instance.
|
;; Your init file should contain only one such instance.
|
||||||
;; If there is more than one, they won't work right.
|
;; If there is more than one, they won't work right.
|
||||||
'(package-selected-packages
|
'(package-selected-packages
|
||||||
'(gnu-elpa-keyring-update--keyring gnu-elpa-keyring-update lsp-mode catppuccin-theme use-package evil company)))
|
'(marginalia vertico doom-modeline wakatime-mode evil-surround all-the-icons dired-single gnu-elpa-keyring-update--keyring gnu-elpa-keyring-update lsp-mode catppuccin-theme use-package evil company)))
|
||||||
(custom-set-faces
|
(custom-set-faces
|
||||||
;; custom-set-faces was added by Custom.
|
;; custom-set-faces was added by Custom.
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,10 @@
|
||||||
;; Load each modules
|
;; Load each modules
|
||||||
(require 'init-package) ; package manager should be loaded first
|
(require 'init-package) ; package manager should be loaded first
|
||||||
(require 'init-basic)
|
(require 'init-basic)
|
||||||
|
(require 'init-appearance) ; package manager should be loaded first
|
||||||
(require 'init-keymaps)
|
(require 'init-keymaps)
|
||||||
(require 'init-evil)
|
(require 'init-evil)
|
||||||
|
(require 'init-file)
|
||||||
;; (require 'init-lsp) ; FIXME: See .emacs.d/lisp/init-lsp.el
|
;; (require 'init-lsp) ; FIXME: See .emacs.d/lisp/init-lsp.el
|
||||||
|
|
||||||
;; Load `custom` file
|
;; Load `custom` file
|
||||||
|
|
|
||||||
29
tools/emacs.d/lisp/init-appearance.el
Normal file
29
tools/emacs.d/lisp/init-appearance.el
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
;;; init-appearance.el
|
||||||
|
|
||||||
|
(when (display-graphic-p)
|
||||||
|
(add-to-list 'default-frame-alist '(font . "JetBrainsMono NF")))
|
||||||
|
|
||||||
|
;; Icon Support
|
||||||
|
;; Once installed, Manually install the fonts required:
|
||||||
|
;; M-x all-the-icons-install-fonts
|
||||||
|
;; If under Microsoft Windows, the Installation Directory should be chosen
|
||||||
|
;; and right-click them to install the fonts
|
||||||
|
(use-package all-the-icons
|
||||||
|
:if (display-graphic-p))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package catppuccin-theme
|
||||||
|
:config
|
||||||
|
(setq catppuccin-flavor 'mocha) ; This looks like shit in terminal mode
|
||||||
|
(load-theme 'catppuccin t))
|
||||||
|
|
||||||
|
|
||||||
|
;; Better mode line, see (L7) Icon install
|
||||||
|
;; M-x nerd-icons-install-fonts
|
||||||
|
(use-package doom-modeline
|
||||||
|
:ensure t
|
||||||
|
:init (doom-modeline-mode 1))
|
||||||
|
|
||||||
|
(global-tab-line-mode) ; bufferline
|
||||||
|
|
||||||
|
(provide 'init-appearance)
|
||||||
|
|
@ -14,13 +14,6 @@
|
||||||
;; https://book.emacs-china.org/#orgcfd105e Open with Emacs
|
;; https://book.emacs-china.org/#orgcfd105e Open with Emacs
|
||||||
(server-mode 1)
|
(server-mode 1)
|
||||||
|
|
||||||
(when (display-graphic-p)
|
|
||||||
(add-to-list 'default-frame-alist '(font . "JetBrainsMono NF")))
|
|
||||||
|
|
||||||
(use-package catppuccin-theme
|
|
||||||
:config
|
|
||||||
(setq catppuccin-flavor 'mocha) ; This looks like shit in terminal mode
|
|
||||||
(load-theme 'catppuccin t))
|
|
||||||
|
|
||||||
(require 'recentf)
|
(require 'recentf)
|
||||||
(recentf-mode 1)
|
(recentf-mode 1)
|
||||||
|
|
|
||||||
22
tools/emacs.d/lisp/init-edit.el
Normal file
22
tools/emacs.d/lisp/init-edit.el
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
;;; init-edit.el
|
||||||
|
|
||||||
|
;; Company - Complete Anything
|
||||||
|
(use-package company
|
||||||
|
:ensure t
|
||||||
|
:hook (after-init . global-company-mode) ; 在启动后自动启用 global-company-mode
|
||||||
|
:bind (:map company-active-map ; TODO: Seems does not work
|
||||||
|
("C-n" . company-select-next)
|
||||||
|
("C-p" . company-select-previous))
|
||||||
|
:config
|
||||||
|
(setq company-minimum-prefix-length 1 ; 设置最短补全前缀
|
||||||
|
company-idle-delay 0.2)) ; 设置补全延迟(秒)
|
||||||
|
|
||||||
|
;; minibuffer 补全增强
|
||||||
|
(use-package vertico
|
||||||
|
:init
|
||||||
|
(vertico-mode))
|
||||||
|
|
||||||
|
;; 提供补全注解
|
||||||
|
(use-package marginalia
|
||||||
|
:init
|
||||||
|
(marginalia-mode))
|
||||||
|
|
@ -22,6 +22,12 @@
|
||||||
"E" '(lambda () (interactive) (evil-previous-line 5)) ; 5e
|
"E" '(lambda () (interactive) (evil-previous-line 5)) ; 5e
|
||||||
))
|
))
|
||||||
|
|
||||||
|
;; Text Objects Keymap - Use `l` for inner (swap i and l)
|
||||||
|
;; https://github.com/emacs-evil/evil/blob/master/evil-maps.el#L398-L421
|
||||||
|
(define-key evil-visual-state-map "l" evil-inner-text-objects-map)
|
||||||
|
(define-key evil-operator-state-map "l" evil-inner-text-objects-map)
|
||||||
|
|
||||||
|
|
||||||
;; Provides Vim-like Leader key <SPC>
|
;; Provides Vim-like Leader key <SPC>
|
||||||
(use-package evil-leader
|
(use-package evil-leader
|
||||||
:after evil
|
:after evil
|
||||||
|
|
@ -37,5 +43,11 @@
|
||||||
:config
|
:config
|
||||||
(evil-commentary-mode))
|
(evil-commentary-mode))
|
||||||
|
|
||||||
|
;; Evil Surround: Vim-surround Evil fork
|
||||||
|
(use-package evil-surround
|
||||||
|
:after evil
|
||||||
|
:config
|
||||||
|
(global-evil-surround-mode 1))
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-evil)
|
(provide 'init-evil)
|
||||||
|
|
|
||||||
24
tools/emacs.d/lisp/init-file.el
Normal file
24
tools/emacs.d/lisp/init-file.el
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
;;; init-file.el -- File Management configuration
|
||||||
|
;;; First edit at 2025/01/29
|
||||||
|
|
||||||
|
;; Dired
|
||||||
|
|
||||||
|
;; Dired Configuration
|
||||||
|
(with-eval-after-load 'dired
|
||||||
|
(setq dired-recursive-deletes 'top) ;; Ask Before Delete Dir
|
||||||
|
(setq dired-recursive-copies 'always) ;; Always Copy Dir
|
||||||
|
(setq dired-dwim-target t)) ;; dwim for Do What I Mean - 当分屏显示两个 Buffer 时,复制或移动文件会自动将另一个 dired buffer 作为目标目录
|
||||||
|
|
||||||
|
;; Dired Keybindings - Colemak
|
||||||
|
(evil-define-key 'normal dired-mode-map
|
||||||
|
"h" 'dired-up-directory
|
||||||
|
"i" 'dired-find-file
|
||||||
|
"n" 'dired-next-line
|
||||||
|
"e" 'dired-previous-line)
|
||||||
|
|
||||||
|
;; This prevents Dired from opening more buffers
|
||||||
|
;; https://stackoverflow.com/q/1839313
|
||||||
|
(setq dired-kill-when-opening-new-dired-buffer t)
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'init-file)
|
||||||
|
|
@ -33,16 +33,6 @@
|
||||||
; Re-enable signature
|
; Re-enable signature
|
||||||
(setq package-check-signature 'allow-unsigned)
|
(setq package-check-signature 'allow-unsigned)
|
||||||
|
|
||||||
;; Company - Complete Anything
|
|
||||||
(use-package company
|
|
||||||
:ensure t
|
|
||||||
:hook (after-init . global-company-mode) ; 在启动后自动启用 global-company-mode
|
|
||||||
:bind (:map company-active-map ; TODO: Seems does not work
|
|
||||||
("C-n" . company-select-next)
|
|
||||||
("C-p" . company-select-previous))
|
|
||||||
:config
|
|
||||||
(setq company-minimum-prefix-length 1 ; 设置最短补全前缀
|
|
||||||
company-idle-delay 0.2)) ; 设置补全延迟(秒)
|
|
||||||
|
|
||||||
;; Which Key - Prompt available commands
|
;; Which Key - Prompt available commands
|
||||||
(use-package which-key
|
(use-package which-key
|
||||||
|
|
@ -74,5 +64,11 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
(use-package wakatime-mode
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(global-wakatime-mode))
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-package)
|
(provide 'init-package)
|
||||||
;;; init-package.el ends here
|
;;; init-package.el ends here
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue