feat(config): Improve dired, keybindings, terminal UI and add packages
- Add dired buffer killing and custom dirvish layout toggle - Replace ido with fido-mode in terminal config - Add custom terminal color theme with 24-bit color support - Add new packages: tokei, helpful, gptel-magit - Refactor project keybindings under C-x p prefix - Add mwim navigation bindings globally - Improve ibuffer filter groups and consult buffer filters - Add diff-mode keybindings and refine magit diff display
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
|
||||||
(use-package dired
|
(use-package dired
|
||||||
:straight nil
|
:straight nil
|
||||||
:config
|
:config
|
||||||
@@ -18,7 +17,9 @@
|
|||||||
dired-recursive-copies 'always
|
dired-recursive-copies 'always
|
||||||
dired-mouse-drag-files t
|
dired-mouse-drag-files t
|
||||||
mouse-drag-and-drop-region-cross-program t
|
mouse-drag-and-drop-region-cross-program t
|
||||||
dired-compress-file-default-suffix ".zip")
|
dired-compress-file-default-suffix ".zip"
|
||||||
|
dired-kill-when-opening-new-buffer t
|
||||||
|
dired-kill-when-opening-new-dired-buffer t)
|
||||||
(put 'dired-find-alternate-file 'disabled nil))
|
(put 'dired-find-alternate-file 'disabled nil))
|
||||||
|
|
||||||
;; dirvish
|
;; dirvish
|
||||||
@@ -42,7 +43,8 @@
|
|||||||
|
|
||||||
(if *is-android*
|
(if *is-android*
|
||||||
(setq dirvish-default-layout '(1 0.6))
|
(setq dirvish-default-layout '(1 0.6))
|
||||||
(setq dirvish-default-layout '(1 0.15 0.45)))
|
(setq dirvish-default-layout nil
|
||||||
|
dirvish-layout-recipes '((1 0.15 0.45))))
|
||||||
|
|
||||||
(with-eval-after-load 'dirvish
|
(with-eval-after-load 'dirvish
|
||||||
(add-hook 'dired-mode-hook #'dired-hide-details-mode))
|
(add-hook 'dired-mode-hook #'dired-hide-details-mode))
|
||||||
|
|||||||
@@ -131,6 +131,8 @@
|
|||||||
(my-desktop-init)))
|
(my-desktop-init)))
|
||||||
|
|
||||||
(use-package xdg-launcher
|
(use-package xdg-launcher
|
||||||
|
:demand t
|
||||||
|
:after exwm
|
||||||
:straight
|
:straight
|
||||||
(xdg-launcher :type git
|
(xdg-launcher :type git
|
||||||
:host github
|
:host github
|
||||||
|
|||||||
@@ -119,6 +119,10 @@ from the last 1500 characters of the buffer."
|
|||||||
(gptel-agent-update))
|
(gptel-agent-update))
|
||||||
|
|
||||||
(use-package gptel-magit
|
(use-package gptel-magit
|
||||||
|
:straight
|
||||||
|
(gptel-magit :type git
|
||||||
|
:host github
|
||||||
|
:repo "ArthurHeymans/gptel-magit")
|
||||||
:hook
|
:hook
|
||||||
(magit-mode . gptel-magit-install)
|
(magit-mode . gptel-magit-install)
|
||||||
|
|
||||||
|
|||||||
@@ -108,12 +108,21 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(interactive)
|
(interactive)
|
||||||
(align-regexp (region-beginning) (region-end) "\\(\\s-*\\)::" 1 1 nil))
|
(align-regexp (region-beginning) (region-end) "\\(\\s-*\\)::" 1 1 nil))
|
||||||
|
|
||||||
(defun my/dired-next-line()
|
(defun my-dired-next-line()
|
||||||
"Move to forward line in dired buffer"
|
"Move to forward line in dired buffer"
|
||||||
(interactive)
|
(interactive)
|
||||||
(forward-line 1)
|
(forward-line 1)
|
||||||
(dired-move-to-filename))
|
(dired-move-to-filename))
|
||||||
|
|
||||||
|
(defun my-dirvish-layout-toggle ()
|
||||||
|
"Toggle layout using first recipe in `dirvish-layout-recipes' instead of fallback."
|
||||||
|
(interactive)
|
||||||
|
(let ((dv (dirvish-curr)))
|
||||||
|
(unless dv (user-error "Not a dirvish buffer"))
|
||||||
|
(unless (dv-curr-layout dv)
|
||||||
|
(setf (dv-ff-layout dv) (car dirvish-layout-recipes)))
|
||||||
|
(dirvish-layout-toggle)))
|
||||||
|
|
||||||
(defun my-magit-toggle-parent-section ()
|
(defun my-magit-toggle-parent-section ()
|
||||||
"Toggle parent magit section."
|
"Toggle parent magit section."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
"t" 'gptel-tools)
|
"t" 'gptel-tools)
|
||||||
|
|
||||||
(general-def gptel-mode-map
|
(general-def gptel-mode-map
|
||||||
"C-c C-s" 'my-gptel-save-session)
|
"C-c C-s" 'my-gptel-save-session
|
||||||
|
"C-c C-k" 'gptel-abort)
|
||||||
|
|
||||||
;; u for ui
|
;; u for ui
|
||||||
(general-def
|
(general-def
|
||||||
@@ -64,6 +65,16 @@
|
|||||||
"o" 'consult-outline
|
"o" 'consult-outline
|
||||||
"i" 'consult-info)
|
"i" 'consult-info)
|
||||||
|
|
||||||
|
;; p for project
|
||||||
|
(general-def
|
||||||
|
:prefix "C-x p"
|
||||||
|
"b" 'consult-project-buffer
|
||||||
|
"E" 'eat-project
|
||||||
|
"r" 'consult-ripgrep-project
|
||||||
|
"R" 'project-query-replace-regexp
|
||||||
|
"v" 'magit-project-status
|
||||||
|
"V" 'project-vc-dir)
|
||||||
|
|
||||||
;; t for modes toggle
|
;; t for modes toggle
|
||||||
(general-def
|
(general-def
|
||||||
:prefix "C-c t"
|
:prefix "C-c t"
|
||||||
@@ -132,15 +143,15 @@
|
|||||||
"M-." 'scroll-other-window
|
"M-." 'scroll-other-window
|
||||||
"<mouse-2>" 'emms-play-dired
|
"<mouse-2>" 'emms-play-dired
|
||||||
"C-c m a" 'emms-add-dired
|
"C-c m a" 'emms-add-dired
|
||||||
"<down>" 'my/dired-next-line
|
"<down>" 'my-dired-next-line
|
||||||
"C-n" 'my/dired-next-line
|
"C-n" 'my-dired-next-line
|
||||||
"n" 'my/dired-next-line
|
"n" 'my-dired-next-line
|
||||||
"b" 'dired-up-directory
|
"b" 'dired-up-directory
|
||||||
"C-b" 'dired-up-directory
|
"C-b" 'dired-up-directory
|
||||||
"<right>" 'dired-find-file
|
"<right>" 'dired-find-file
|
||||||
"<left>" 'dired-up-directory
|
"<left>" 'dired-up-directory
|
||||||
"C-f" 'dired-find-file
|
"C-f" 'dired-find-file
|
||||||
"<SPC>" 'dirvish-layout-toggle
|
"<SPC>" 'my-dirvish-layout-toggle
|
||||||
"C-s" 'consult-line
|
"C-s" 'consult-line
|
||||||
"C-r" 'consult-line)
|
"C-r" 'consult-line)
|
||||||
|
|
||||||
@@ -154,7 +165,7 @@
|
|||||||
"y" 'dirvish-yank-menu)
|
"y" 'dirvish-yank-menu)
|
||||||
|
|
||||||
;; magit
|
;; magit
|
||||||
(general-def magit-mode-map
|
(general-def (magit-mode-map tokei-mode-map)
|
||||||
"C-<tab>" 'my-magit-toggle-parent-section
|
"C-<tab>" 'my-magit-toggle-parent-section
|
||||||
"p" 'magit-section-backward-sibling
|
"p" 'magit-section-backward-sibling
|
||||||
"M-p" 'magit-section-backward
|
"M-p" 'magit-section-backward
|
||||||
@@ -212,7 +223,9 @@
|
|||||||
"C-c o l" 'denote-link
|
"C-c o l" 'denote-link
|
||||||
"C-c o L" 'denote-org-link-to-heading
|
"C-c o L" 'denote-org-link-to-heading
|
||||||
"C-c o b" 'denote-backlinks
|
"C-c o b" 'denote-backlinks
|
||||||
"C-c o B" 'denote-org-backlinks-for-heading)
|
"C-c o B" 'denote-org-backlinks-for-heading
|
||||||
|
"C-a" 'mwim-beginning
|
||||||
|
"C-e" 'mwim-end)
|
||||||
|
|
||||||
;; hs-hide-mode
|
;; hs-hide-mode
|
||||||
(general-def hs-minor-mode-map
|
(general-def hs-minor-mode-map
|
||||||
@@ -250,6 +263,10 @@
|
|||||||
(general-def Info-mode-map
|
(general-def Info-mode-map
|
||||||
"M-n" 'forward-paragraph)
|
"M-n" 'forward-paragraph)
|
||||||
|
|
||||||
|
;; diff
|
||||||
|
(general-def diff-mode-map
|
||||||
|
"M-o" 'other-window)
|
||||||
|
|
||||||
;; discomfort
|
;; discomfort
|
||||||
(general-def discomfort-mode-map
|
(general-def discomfort-mode-map
|
||||||
"p" 'previous-line
|
"p" 'previous-line
|
||||||
@@ -314,6 +331,8 @@
|
|||||||
"C-x u" 'vundo
|
"C-x u" 'vundo
|
||||||
|
|
||||||
;; navigate
|
;; navigate
|
||||||
|
"C-a" 'mwim-beginning
|
||||||
|
"C-e" 'mwim-end
|
||||||
"M-p" 'backward-paragraph
|
"M-p" 'backward-paragraph
|
||||||
"M-n" 'forward-paragraph
|
"M-n" 'forward-paragraph
|
||||||
"<mouse-2>" 'xref-find-definitions-at-mouse
|
"<mouse-2>" 'xref-find-definitions-at-mouse
|
||||||
@@ -336,10 +355,7 @@
|
|||||||
|
|
||||||
;; other
|
;; other
|
||||||
"C-x r b" 'consult-bookmark
|
"C-x r b" 'consult-bookmark
|
||||||
"C-x p b" 'consult-project-buffer
|
"C-x v =" 'magit-diff-buffer-file
|
||||||
"C-x p E" 'eat-project
|
|
||||||
"C-x p r" 'consult-ripgrep-project
|
|
||||||
"C-x p R" 'project-query-replace-regexp
|
|
||||||
"C-;" 'embark-act)
|
"C-;" 'embark-act)
|
||||||
|
|
||||||
(when *is-android*
|
(when *is-android*
|
||||||
|
|||||||
@@ -32,11 +32,7 @@
|
|||||||
(use-package drag-stuff)
|
(use-package drag-stuff)
|
||||||
|
|
||||||
;; mwim,更聪明的beginning/end of line
|
;; mwim,更聪明的beginning/end of line
|
||||||
(use-package mwim
|
(use-package mwim)
|
||||||
:bind (([remap move-beginning-of-line] . mwim-beginning)
|
|
||||||
([remap move-end-of-line] . mwim-end)
|
|
||||||
([remap org-beginning-of-line] . mwim-beginning)
|
|
||||||
([remap org-end-of-line] . mwim-end)))
|
|
||||||
|
|
||||||
;; which-key,快捷键提示
|
;; which-key,快捷键提示
|
||||||
(use-package which-key
|
(use-package which-key
|
||||||
@@ -66,22 +62,31 @@
|
|||||||
;; consult,搜索与导航
|
;; consult,搜索与导航
|
||||||
(use-package consult
|
(use-package consult
|
||||||
:config
|
:config
|
||||||
;; everything
|
;; set locate arguments
|
||||||
(when *is-windows*
|
(cond
|
||||||
(setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk))
|
(*is-windows*
|
||||||
(setq consult-ripgrep-args (encode-coding-string
|
(setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk)
|
||||||
"rg --null --line-buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --line-number"
|
consult-ripgrep-args (encode-coding-string
|
||||||
'gbk))
|
"rg --null --line-buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --line-number"
|
||||||
|
'gbk))
|
||||||
(add-to-list 'process-coding-system-alist '("es" gbk . gbk)))
|
(add-to-list 'process-coding-system-alist '("es" gbk . gbk)))
|
||||||
|
(*is-mac*
|
||||||
;; mdfind
|
|
||||||
(when *is-mac*
|
|
||||||
(setq consult-locate-args "mdfind -name"))
|
(setq consult-locate-args "mdfind -name"))
|
||||||
|
(*is-linux*
|
||||||
;; plocate
|
|
||||||
(when *is-linux*
|
|
||||||
(setq consult-locate-args "plocate --basename --ignore-case")))
|
(setq consult-locate-args "plocate --basename --ignore-case")))
|
||||||
|
|
||||||
|
;; set some buffer filter
|
||||||
|
(setq consult-buffer-filter
|
||||||
|
(cl-union consult-buffer-filter
|
||||||
|
'("^\\*dirvish"
|
||||||
|
"^PREVIEW"
|
||||||
|
"^\\*helpful"
|
||||||
|
"^\\*Help"
|
||||||
|
"Diff"
|
||||||
|
"straight"
|
||||||
|
"\\*Messages\\*")
|
||||||
|
:test 'equal)))
|
||||||
|
|
||||||
;; embark,快捷指令
|
;; embark,快捷指令
|
||||||
(use-package embark
|
(use-package embark
|
||||||
:config
|
:config
|
||||||
@@ -176,7 +181,10 @@ targets."
|
|||||||
(save-place-mode))
|
(save-place-mode))
|
||||||
|
|
||||||
;; 撤回增强和跨会话历史
|
;; 撤回增强和跨会话历史
|
||||||
(use-package undo-fu)
|
(use-package undo-fu
|
||||||
|
:config
|
||||||
|
(setq undo-in-region t
|
||||||
|
undo-fu-allow-undo-in-region t))
|
||||||
|
|
||||||
(use-package undo-fu-session
|
(use-package undo-fu-session
|
||||||
:init
|
:init
|
||||||
@@ -198,13 +206,14 @@ targets."
|
|||||||
|
|
||||||
;; project
|
;; project
|
||||||
(use-package project
|
(use-package project
|
||||||
:bind
|
|
||||||
([remap project-vc-dir] . magit-project-status)
|
|
||||||
:config
|
:config
|
||||||
(setq project-switch-commands (assq-delete-all 'project-vc-dir project-switch-commands))
|
(setq project-switch-commands (assq-delete-all 'project-vc-dir project-switch-commands))
|
||||||
(add-to-list 'project-switch-commands '(magit-project-status "Magit" ?v))
|
(setq project-switch-commands
|
||||||
(add-to-list 'project-switch-commands '(eat-project "Eat" ?E))
|
(seq-uniq (append project-switch-commands
|
||||||
(add-to-list 'project-switch-commands '(consult-ripgrep-project "Ripgrep" ?r)))
|
'((magit-project-status "Magit" ?v)
|
||||||
|
(eat-project "Eat" ?E)
|
||||||
|
(project-query-replace-regexp "Query Replace" ?R)
|
||||||
|
(consult-ripgrep-project "Ripgrep" ?r))))))
|
||||||
|
|
||||||
;; ibuffer
|
;; ibuffer
|
||||||
(use-package ibuffer
|
(use-package ibuffer
|
||||||
@@ -227,7 +236,8 @@ targets."
|
|||||||
("Config" (or
|
("Config" (or
|
||||||
(mode . conf-mode)
|
(mode . conf-mode)
|
||||||
(mode . conf-desktop-mode)
|
(mode . conf-desktop-mode)
|
||||||
(mode . conf-toml-mode)))
|
(mode . conf-toml-mode)
|
||||||
|
(mode . conf-xdefaults-mode)))
|
||||||
("Elisp" (mode . emacs-lisp-mode))
|
("Elisp" (mode . emacs-lisp-mode))
|
||||||
("Scheme" (or
|
("Scheme" (or
|
||||||
(mode . scheme-mode)))
|
(mode . scheme-mode)))
|
||||||
@@ -254,14 +264,9 @@ targets."
|
|||||||
(mode . org-mode)
|
(mode . org-mode)
|
||||||
(mode . markdown-mode)
|
(mode . markdown-mode)
|
||||||
(name . "^\\*\\[D\\] FILE backlinks for")))
|
(name . "^\\*\\[D\\] FILE backlinks for")))
|
||||||
("Emacs" (or
|
("Help" (or
|
||||||
(name . "^\\*Help\\*$")
|
(mode . help-mode)
|
||||||
(name . "^\\*Custom.*")
|
(mode . helpful-mode)))
|
||||||
(name . "^\\*EMMS Playlist\\*")
|
|
||||||
(name . "^\\*Messages\\*$")
|
|
||||||
(name . "*Chinese-word-segmentation*")
|
|
||||||
(name . "^*Buffer List*")
|
|
||||||
(name . "\\*discomfort\\*")))
|
|
||||||
("Info" (or
|
("Info" (or
|
||||||
(name . "^\\*info")))
|
(name . "^\\*info")))
|
||||||
("Magit" (or
|
("Magit" (or
|
||||||
@@ -275,7 +280,25 @@ targets."
|
|||||||
("Directories" (or
|
("Directories" (or
|
||||||
(mode . dired-mode)
|
(mode . dired-mode)
|
||||||
(name . "^*dirvish")))
|
(name . "^*dirvish")))
|
||||||
("Diff" (name . "^*Diff")))))
|
("Grep" (or
|
||||||
|
(mode . grep-mode)
|
||||||
|
(mode . rg-mode)
|
||||||
|
(mode . xref--xref-buffer-mode)
|
||||||
|
(mode . xref-edit-mode)))
|
||||||
|
("Diff" (name . "^*Diff"))
|
||||||
|
("Emacs" (or
|
||||||
|
(name . "^\\*Help\\*$")
|
||||||
|
(name . "^\\*Custom.*")
|
||||||
|
(name . "^\\*EMMS Playlist\\*")
|
||||||
|
(name . "^\\*Messages\\*$")
|
||||||
|
(name . "*Chinese-word-segmentation*")
|
||||||
|
(name . "^*Buffer List*")
|
||||||
|
(name . "\\*discomfort\\*")
|
||||||
|
(mode . calendar-mode)
|
||||||
|
(mode . calc-mode)
|
||||||
|
(mode . calc-trail-mode)
|
||||||
|
(mode . grep-mode)
|
||||||
|
(mode . occur-mode))))))
|
||||||
|
|
||||||
(add-hook 'ibuffer-hook
|
(add-hook 'ibuffer-hook
|
||||||
(lambda () (ibuffer-switch-to-saved-filter-groups "Main")
|
(lambda () (ibuffer-switch-to-saved-filter-groups "Main")
|
||||||
@@ -372,7 +395,7 @@ targets."
|
|||||||
(unless *is-android* (which-key-enable-god-mode-support))
|
(unless *is-android* (which-key-enable-god-mode-support))
|
||||||
(setq god-mode-enable-function-key-translation nil
|
(setq god-mode-enable-function-key-translation nil
|
||||||
god-exempt-major-modes
|
god-exempt-major-modes
|
||||||
(delete-dups (append '(diff-mode exwm-mode) god-exempt-major-modes))
|
(cl-union '(diff-mode exwm-mode) god-exempt-major-modes :test 'equal)
|
||||||
god-mode-lighter-string "THANK-GOD-MODE")
|
god-mode-lighter-string "THANK-GOD-MODE")
|
||||||
|
|
||||||
(defun my-sync-god-mode-lighter-face (&rest _)
|
(defun my-sync-god-mode-lighter-face (&rest _)
|
||||||
@@ -408,14 +431,17 @@ targets."
|
|||||||
(consult-customize consult-source-buffer :hidden t :default nil)
|
(consult-customize consult-source-buffer :hidden t :default nil)
|
||||||
(add-to-list 'consult-buffer-sources persp-consult-source))
|
(add-to-list 'consult-buffer-sources persp-consult-source))
|
||||||
(setq switch-to-prev-buffer-skip
|
(setq switch-to-prev-buffer-skip
|
||||||
(lambda (win buff bury-or-kill)
|
(lambda (win buff bury-or-kill)
|
||||||
(not (persp-is-current-buffer buff))))
|
(or (not (persp-is-current-buffer buff))
|
||||||
|
(cl-some (lambda (re) (string-match-p re (buffer-name buff)))
|
||||||
|
consult-buffer-filter))))
|
||||||
(setq persp-initial-frame-name "main"))
|
(setq persp-initial-frame-name "main"))
|
||||||
|
|
||||||
;; magit
|
;; magit
|
||||||
(use-package magit
|
(use-package magit
|
||||||
:config
|
:config
|
||||||
(setq magit-bind-magit-project-status nil))
|
(setq magit-bind-magit-project-status nil
|
||||||
|
magit-diff-refine-hunk 'all))
|
||||||
|
|
||||||
;; git-timemachine
|
;; git-timemachine
|
||||||
(use-package git-timemachine)
|
(use-package git-timemachine)
|
||||||
@@ -436,6 +462,25 @@ targets."
|
|||||||
emms-info-functions '(emms-info-native))
|
emms-info-functions '(emms-info-native))
|
||||||
(emms-history-load))
|
(emms-history-load))
|
||||||
|
|
||||||
|
;; tokei
|
||||||
|
(use-package tokei)
|
||||||
|
|
||||||
|
;; helpful
|
||||||
|
(use-package helpful
|
||||||
|
:bind
|
||||||
|
(([remap describe-function] . helpful-callable)
|
||||||
|
([remap describe-command] . helpful-command)
|
||||||
|
([remap describe-variable] . helpful-variable)
|
||||||
|
([remap describe-key] . helpful-key)
|
||||||
|
([remap describe-symbol] . helpful-symbol)
|
||||||
|
:map emacs-lisp-mode-map
|
||||||
|
("C-c C-d C-d" . helpful-at-point)
|
||||||
|
:map lisp-interaction-mode-map
|
||||||
|
("C-c C-d C-d" . helpful-at-point)
|
||||||
|
:map helpful-mode-map
|
||||||
|
("C-x K" . helpful-kill-buffers)
|
||||||
|
("r" . remove-hook-at-point)))
|
||||||
|
|
||||||
(provide 'init-package)
|
(provide 'init-package)
|
||||||
|
|
||||||
;;; init-package.el ends here
|
;;; init-package.el ends here
|
||||||
|
|||||||
@@ -11,10 +11,9 @@
|
|||||||
(toggle-frame-fullscreen)
|
(toggle-frame-fullscreen)
|
||||||
(global-unset-key (kbd "<f12>"))
|
(global-unset-key (kbd "<f12>"))
|
||||||
(global-set-key (kbd "<f12>") 'toggle-frame-fullscreen))
|
(global-set-key (kbd "<f12>") 'toggle-frame-fullscreen))
|
||||||
(*is-linux*
|
|
||||||
(toggle-frame-fullscreen))
|
|
||||||
(*is-windows*
|
(*is-windows*
|
||||||
(toggle-frame-maximized)))
|
(toggle-frame-maximized))
|
||||||
|
(t nil))
|
||||||
|
|
||||||
;; 配置备份文件和自动保存文件目录
|
;; 配置备份文件和自动保存文件目录
|
||||||
(setq backup-directory-alist
|
(setq backup-directory-alist
|
||||||
@@ -116,6 +115,9 @@
|
|||||||
;; kill-line删除换行符
|
;; kill-line删除换行符
|
||||||
(setq kill-whole-line t)
|
(setq kill-whole-line t)
|
||||||
|
|
||||||
|
;; 更方便地pop mark
|
||||||
|
(setq set-mark-command-repeat-pop t)
|
||||||
|
|
||||||
(provide 'init-startup)
|
(provide 'init-startup)
|
||||||
|
|
||||||
;;; init-startup.el ends here
|
;;; init-startup.el ends here
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
;; general
|
||||||
|
(use-package general)
|
||||||
|
|
||||||
(defun open-init-file()
|
(defun open-init-file()
|
||||||
"Open user's init.el file in ~/.emacs.d ."
|
"Open user's init.el file in ~/.emacs.d ."
|
||||||
(interactive)
|
(interactive)
|
||||||
@@ -12,7 +15,12 @@
|
|||||||
;; scratch buffer
|
;; scratch buffer
|
||||||
(if *is-mac*
|
(if *is-mac*
|
||||||
(general-def "C-c <f12>" 'scratch-buffer)
|
(general-def "C-c <f12>" 'scratch-buffer)
|
||||||
(general-def "C-c <delete>" 'scratch-buffer))
|
(general-def "C-c <delete>" 'scratch-buffer)
|
||||||
|
(general-def "C-c <deletechar>" 'scratch-buffer))
|
||||||
|
|
||||||
|
;; diff
|
||||||
|
(general-def diff-mode-map
|
||||||
|
"M-o" 'other-window)
|
||||||
|
|
||||||
;; global map with C-c prefix
|
;; global map with C-c prefix
|
||||||
(general-def
|
(general-def
|
||||||
@@ -27,8 +35,6 @@
|
|||||||
|
|
||||||
;; buffer, file, and window
|
;; buffer, file, and window
|
||||||
"<f2>" 'open-init-file
|
"<f2>" 'open-init-file
|
||||||
"M-[" 'previous-buffer
|
|
||||||
"M-]" 'next-buffer
|
|
||||||
"C-x C-b" 'ibuffer-other-window
|
"C-x C-b" 'ibuffer-other-window
|
||||||
"C-x K" 'crux-kill-other-buffers
|
"C-x K" 'crux-kill-other-buffers
|
||||||
|
|
||||||
@@ -39,7 +45,6 @@
|
|||||||
"C-," 'crux-duplicate-current-line-or-region
|
"C-," 'crux-duplicate-current-line-or-region
|
||||||
"C-k" 'crux-smart-kill-line
|
"C-k" 'crux-smart-kill-line
|
||||||
"C-<backspace>" 'crux-kill-line-backwards
|
"C-<backspace>" 'crux-kill-line-backwards
|
||||||
"C-a" 'crux-move-beginning-of-line
|
|
||||||
"M-y" 'yank-from-kill-ring
|
"M-y" 'yank-from-kill-ring
|
||||||
"C-c DEL" 'hungry-delete-backward
|
"C-c DEL" 'hungry-delete-backward
|
||||||
"C-c C-DEL" 'hungry-delete-forward
|
"C-c C-DEL" 'hungry-delete-forward
|
||||||
@@ -47,12 +52,15 @@
|
|||||||
"M-N" 'drag-stuff-down
|
"M-N" 'drag-stuff-down
|
||||||
"C-M-@" 'er/mark-symbol
|
"C-M-@" 'er/mark-symbol
|
||||||
"M-@" 'er/mark-word
|
"M-@" 'er/mark-word
|
||||||
|
"C-M-h" 'backward-kill-sexp
|
||||||
|
|
||||||
;; undo
|
;; undo
|
||||||
"C-/" 'undo
|
"C-/" 'undo
|
||||||
"C-M-_" 'undo-redo
|
"C-M-_" 'undo-redo
|
||||||
|
|
||||||
;; navigate
|
;; navigate
|
||||||
|
"C-a" 'mwim-beginning
|
||||||
|
"C-e" 'mwim-end
|
||||||
"M-p" 'backward-paragraph
|
"M-p" 'backward-paragraph
|
||||||
"M-n" 'forward-paragraph
|
"M-n" 'forward-paragraph
|
||||||
|
|
||||||
|
|||||||
@@ -20,32 +20,34 @@
|
|||||||
:config
|
:config
|
||||||
(setq expand-region-smart-cursor t))
|
(setq expand-region-smart-cursor t))
|
||||||
|
|
||||||
|
;; mwim,更聪明的beginning/end of line
|
||||||
|
(use-package mwim)
|
||||||
|
|
||||||
;; 启用savehist,保存命令顺序
|
;; 启用savehist,保存命令顺序
|
||||||
(use-package savehist
|
(use-package savehist
|
||||||
:init (setq enable-recursive-minibuffers t
|
:init
|
||||||
history-length 50
|
(setq enable-recursive-minibuffers t
|
||||||
savehist-additional-variables '(mark-ring
|
history-length 50
|
||||||
global-mark-ring
|
savehist-additional-variables '(mark-ring
|
||||||
search-ring
|
global-mark-ring
|
||||||
regexp-search-ring
|
search-ring
|
||||||
extended-command-history)
|
regexp-search-ring
|
||||||
savehist-autosave-interval 300)
|
extended-command-history)
|
||||||
|
savehist-autosave-interval 300)
|
||||||
(savehist-mode))
|
(savehist-mode))
|
||||||
|
|
||||||
;; saveplace,保存光标位置
|
;; saveplace,保存光标位置
|
||||||
(use-package saveplace
|
(use-package saveplace
|
||||||
:init (save-place-mode))
|
|
||||||
|
|
||||||
;; ido,补全
|
|
||||||
(use-package ido
|
|
||||||
:init
|
:init
|
||||||
(ido-mode)
|
(save-place-mode))
|
||||||
(ido-everywhere)
|
|
||||||
:config
|
|
||||||
(define-key ido-common-completion-map (kbd "SPC") 'ido-restrict-to-matches))
|
|
||||||
|
|
||||||
;; general
|
;; 补全
|
||||||
(use-package general)
|
(use-package icomplete
|
||||||
|
:init
|
||||||
|
(fido-mode)
|
||||||
|
:config
|
||||||
|
(keymap-unset minibuffer-local-completion-map "TAB")
|
||||||
|
(keymap-set minibuffer-local-completion-map "TAB" 'icomplete-force-complete))
|
||||||
|
|
||||||
(provide 'init-terminal-package)
|
(provide 'init-terminal-package)
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,75 @@
|
|||||||
(set-language-environment "UTF-8")
|
(set-language-environment "UTF-8")
|
||||||
(prefer-coding-system 'utf-8)))
|
(prefer-coding-system 'utf-8)))
|
||||||
|
|
||||||
;; 主题
|
|
||||||
;; (load-theme 'tango-dark)
|
|
||||||
|
|
||||||
;; 显示文件大小
|
;; 显示文件大小
|
||||||
(size-indication-mode t)
|
(size-indication-mode t)
|
||||||
|
|
||||||
;; 显示行号列号
|
;; 显示行号列号
|
||||||
(column-number-mode t)
|
(column-number-mode t)
|
||||||
|
|
||||||
|
;; 高亮
|
||||||
|
(global-hl-line-mode t)
|
||||||
|
|
||||||
|
;; 主题
|
||||||
|
(if (>= (display-color-cells) 16777216)
|
||||||
|
(progn
|
||||||
|
(defvar base03 "#062624")
|
||||||
|
(defvar base02 "#0c2b29")
|
||||||
|
(defvar base01 "#4d6967")
|
||||||
|
(defvar base00 "#728e8c")
|
||||||
|
(defvar cyan "#01928d")
|
||||||
|
(defvar blue "#2570cd")
|
||||||
|
(defvar green "#3a9c36")
|
||||||
|
(defvar magenta "#d33682")
|
||||||
|
(defvar yellow "#a87c04")
|
||||||
|
(defvar orange "#c24713")
|
||||||
|
(defvar red "#ce2825")
|
||||||
|
|
||||||
|
(custom-set-faces
|
||||||
|
`(default ((t (:foreground ,base00 :background ,base03))))
|
||||||
|
`(cursor ((t (:inverse t))))
|
||||||
|
`(region ((t (:exdend t :foreground ,base03 :background ,base00))))
|
||||||
|
`(shadow ((t (:foreground ,base01))))
|
||||||
|
`(error ((t (:foreground ,orange))))
|
||||||
|
`(font-lock-builtin-face ((t (:foreground ,base00 :weight bold :slant normal))))
|
||||||
|
`(font-lock-comment-face ((t (:foreground ,base01))))
|
||||||
|
`(font-lock-keyword-face ((t (:foreground ,cyan :weight bold))))
|
||||||
|
`(font-lock-variable-name-face ((t (:foreground ,blue))))
|
||||||
|
`(font-lock-constant-face ((t (:foreground ,blue :weight bold))))
|
||||||
|
`(font-lock-string-face ((t (:foreground ,green))))
|
||||||
|
`(font-lock-type-face ((t (:foreground ,yellow))))
|
||||||
|
`(font-lock-function-name-face ((t (:foreground ,blue))))
|
||||||
|
`(hl-line ((t (:background ,base02 :extend t))))
|
||||||
|
`(show-paren-match ((t (:foreground ,magenta :weight bold))))
|
||||||
|
`(show-paren-mismatch ((t (:foreground ,base03 :background ,red))))
|
||||||
|
`(icomplete-first-match ((t (:foreground ,yellow :weight bold))))
|
||||||
|
`(completions-common-part ((t (:foreground ,blue))))
|
||||||
|
`(minibuffer-prompt ((t (:foreground ,base01 :weight bold))))
|
||||||
|
`(line-number ((t (:foreground ,base01 :weight extra-light))))
|
||||||
|
`(button ((t (:foreground ,base00 :underline t))))
|
||||||
|
`(mode-line ((t (:background ,base00 :foreground ,base03))))
|
||||||
|
`(mode-line-inactive ((t (:background ,base02 :foreground ,base00))))
|
||||||
|
`(dired-header ((t (:foreground ,green))))
|
||||||
|
`(dired-directory ((t (:foreground ,blue))))
|
||||||
|
`(dired-ignored ((t (:foreground ,base01))))
|
||||||
|
`(isearch ((t (:background ,magenta :foreground ,base03))))
|
||||||
|
`(lazy-highlight ((t (:background ,yellow :foreground ,base03))))
|
||||||
|
`(isearch-fail ((t (:foreground ,red))))
|
||||||
|
`(org-block ((t (:inhert default))))
|
||||||
|
`(org-document-title ((t (:inhert default :weight bold))))
|
||||||
|
`(org-document-info ((t (:inhert org-document-title))))
|
||||||
|
`(eshell-prompt ((t (:foreground ,yellow :weight bold))))
|
||||||
|
`(diff-header ((t (:foreground ,base00 :background ,base02))))
|
||||||
|
`(diff-file-header ((t (:inherit: diff-header :weight bold))))
|
||||||
|
`(diff-hunk-header ((t (:foreground "#c1a059" :background "#253224"))))
|
||||||
|
`(diff-added ((t (:foreground "#73b971" :background "#103628"))))
|
||||||
|
`(diff-refine-added ((t (:foreground "#8cc78d" :background "#1d522e"))))
|
||||||
|
`(diff-removed ((t (:foreground "#e17360" :background "#2d2c25"))))
|
||||||
|
`(diff-refine-removed ((t (:foreground "#e7917f" :background "#5c3225"))))))
|
||||||
|
|
||||||
|
(progn
|
||||||
|
(global-hl-line-mode nil)))
|
||||||
|
|
||||||
(provide 'init-terminal-ui)
|
(provide 'init-terminal-ui)
|
||||||
|
|
||||||
;;; init-terminal-ui.el ends here
|
;;; init-terminal-ui.el ends here
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
display-time-string-forms
|
display-time-string-forms
|
||||||
'((propertize
|
'((propertize
|
||||||
(concat
|
(concat
|
||||||
(propertize (format-time-string " %H:%M") 'face 'display-time-date-and-time)
|
(propertize (format-time-string " %I:%M") 'face 'display-time-date-and-time)
|
||||||
(propertize (format-time-string "-%p") 'face 'font-lock-comment-face))
|
(propertize (format-time-string "-%p") 'face 'font-lock-comment-face))
|
||||||
'help-echo (format-time-string "%A, %B %d, %Y"))))
|
'help-echo (format-time-string "%A, %B %d, %Y"))))
|
||||||
(display-time-mode))
|
(display-time-mode))
|
||||||
|
|||||||
@@ -84,7 +84,8 @@
|
|||||||
`(transient-key-noop ((,class (:foreground ,base01 :inherit transient-key))))
|
`(transient-key-noop ((,class (:foreground ,base01 :inherit transient-key))))
|
||||||
`(keycast-key ((,class (:foreground ,green :weight bold))))
|
`(keycast-key ((,class (:foreground ,green :weight bold))))
|
||||||
`(emms-playlist-track-face ((,class (:foreground ,cyan))))
|
`(emms-playlist-track-face ((,class (:foreground ,cyan))))
|
||||||
`(emms-playlist-selected-face ((,class (:foreground ,blue :weight bold)))))))
|
`(emms-playlist-selected-face ((,class (:foreground ,blue :weight bold))))
|
||||||
|
`(diff-hunk-header ((,class (:foreground "#c1a059" :background "#253224")))))))
|
||||||
|
|
||||||
(provide-theme 'my-base16-dark)
|
(provide-theme 'my-base16-dark)
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,8 @@
|
|||||||
`(transient-key-noop ((,class (:foreground ,base01 :inherit transient-key))))
|
`(transient-key-noop ((,class (:foreground ,base01 :inherit transient-key))))
|
||||||
`(keycast-key ((,class (:foreground ,green :weight bold))))
|
`(keycast-key ((,class (:foreground ,green :weight bold))))
|
||||||
`(emms-playlist-track-face ((,class (:foreground ,cyan))))
|
`(emms-playlist-track-face ((,class (:foreground ,cyan))))
|
||||||
`(emms-playlist-selected-face ((,class (:foreground ,blue :weight bold)))))))
|
`(emms-playlist-selected-face ((,class (:foreground ,blue :weight bold))))
|
||||||
|
`(diff-hunk-header ((,class (:foreground "#6b561e" :background "#f0e6b8")))))))
|
||||||
|
|
||||||
(provide-theme 'my-base16-light)
|
(provide-theme 'my-base16-light)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user