Config: optimize dired and theme, add workspace config
This commit is contained in:
2
init.el
2
init.el
@@ -21,9 +21,9 @@
|
||||
(require 'init-completion)
|
||||
(require 'init-window)
|
||||
(require 'init-dired)
|
||||
(require 'init-workspace)
|
||||
(require 'init-kbd)
|
||||
(require 'init-ui)
|
||||
(require 'init-dashboard)
|
||||
(require 'init-segmentation)
|
||||
|
||||
;;; init.el ends here
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(setq dired-dwim-target t)
|
||||
|
||||
(with-eval-after-load 'dirvish
|
||||
(define-key dirvish-mode-map (kbd "<down>")
|
||||
(lambda () (interactive) (forward-line 1) (dired-move-to-filename)))
|
||||
@@ -26,8 +28,13 @@
|
||||
:init
|
||||
(dirvish-override-dired-mode)
|
||||
:config
|
||||
(setq dirvish-hide-details nil)
|
||||
(if *is-mac*
|
||||
(setq dirvish-hide-details t)
|
||||
(setq dirvish-hide-details '(dirvish-side)))
|
||||
(setq dirvish-use-mode-line 'global)
|
||||
(unless *is-windows*
|
||||
(setq dirvish-attributes '(file-time file-size)))
|
||||
(setq dirvish-default-layout '(1 0.15 0.45))
|
||||
:custom
|
||||
(dirvish-quick-access-entries
|
||||
(when *is-windows*
|
||||
@@ -35,32 +42,27 @@
|
||||
("e" "~/.emacs.d/")
|
||||
("p" "c:/Users/gaozh/Pictures/Screenshots/" "Pictures")
|
||||
("d" "f:/下载25-2-10/" "Download")
|
||||
("v" "f:/luping26-1-11/" "Videos")))))
|
||||
("v" "f:/luping26-1-11/" "Videos"))))
|
||||
(dirvish-quick-access-entries
|
||||
(when *is-mac*
|
||||
'(("h" "~/" "Home")
|
||||
("e" "~/.emacs.d/")
|
||||
("p" "~/Pictures/" "Pictures")
|
||||
("d" "~/Downloads/" "Download")
|
||||
("v" "~/Movies/" "Videos")))))
|
||||
|
||||
(use-package trashed
|
||||
:commands (trashed)
|
||||
:config
|
||||
(setq trashed-action-confirmer 'y-or-n-p)
|
||||
(setq trashed-use-header-line t)
|
||||
(setq trashed-sort-key '("Date deleted" . t))
|
||||
(setq trashed-date-format "%Y-%m-%d %H:%M:%S"))
|
||||
|
||||
(setq dired-listing-switches
|
||||
"-l --almost-all --human-readable --group-directories-first --no-group")
|
||||
(put 'dired-find-alternate-file 'disabled nil)
|
||||
|
||||
(with-eval-after-load 'dirvish
|
||||
(global-set-key (kbd "C-c d a") 'dirvish-quick-access)
|
||||
(global-set-key (kbd "C-c d s") 'dirvish-side)
|
||||
(global-set-key (kbd "C-c d h") 'dirvish-history-menu)
|
||||
(global-set-key (kbd "C-x d") 'dired-jump)
|
||||
(global-set-key (kbd "C-x C-j") 'dired)
|
||||
(define-key dired-mode-map (kbd "h") 'dirvish-history-menu)
|
||||
(define-key dired-mode-map (kbd "M-,") 'scroll-other-window-down)
|
||||
(define-key dired-mode-map (kbd "M-.") 'scroll-other-window))
|
||||
|
||||
(with-eval-after-load 'dirvish
|
||||
(global-set-key (kbd "C-c d a") 'dirvish-quick-access)
|
||||
(global-set-key (kbd "C-c d s") 'dirvish-side)
|
||||
(global-set-key (kbd "C-c d h") 'dirvish-history-menu)
|
||||
(global-set-key (kbd "C-x d") 'dired-jump)
|
||||
(global-set-key (kbd "C-x C-j") 'dired)
|
||||
(define-key dired-mode-map (kbd "h") 'dirvish-history-menu)
|
||||
(define-key dired-mode-map (kbd "M-,") 'scroll-other-window-down)
|
||||
(define-key dired-mode-map (kbd "M-.") 'scroll-other-window))
|
||||
|
||||
;; Fix video-mtn preview issue on Windows
|
||||
;; The problem: mtn generates thumbnails with filename like "video.mp4.jpg",
|
||||
;; but dirvish expects MD5-based filename like "a1b2c3d4.jpg"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
(unless jinx-mode
|
||||
(user-error "Jinx mode not enabled in current buffer"))
|
||||
(let* ((curr-line (line-number-at-pos (point)))
|
||||
(overlays (jinx--force-overlays (point-min) (point-max)))
|
||||
(overlays (jinx--force-overlays (point-min) (point-max) :check t))
|
||||
default-cand candidates)
|
||||
(unless overlays
|
||||
(user-error "No misspellings"))
|
||||
|
||||
@@ -82,7 +82,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
(global-set-key (kbd "C-c f j") 'consult-jinx))
|
||||
|
||||
;; pair编辑
|
||||
(global-set-key (kbd "C-c p d") 'delete-pair)
|
||||
;; (global-set-key (kbd "C-c p d") 'delete-pair)
|
||||
|
||||
;; 快速复制当前行
|
||||
(defun duplicate-and-move-to-next-line()
|
||||
@@ -147,6 +147,9 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
(global-set-key (kbd "C-c u c") 'my-color-picker)
|
||||
(global-set-key (kbd "C-c u r") 'rainbow-mode)
|
||||
|
||||
;; indent-bars
|
||||
(global-set-key (kbd "C-c u b") 'indent-bars-mode)
|
||||
|
||||
;; 打开ibuffer
|
||||
(global-set-key (kbd "C-x C-b") 'ibuffer-other-window)
|
||||
(setq ibuffer-default-sorting-mode 'filename)
|
||||
@@ -225,7 +228,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
|
||||
;; avy
|
||||
(global-set-key (kbd "C-M-;") 'avy-goto-char)
|
||||
(global-set-key (kbd "C-M-'") 'ace-pinyin-jump-char)
|
||||
(global-set-key (kbd "C-M-'") 'avy-goto-word-1)
|
||||
(global-set-key (kbd "M-g g") 'avy-goto-line)
|
||||
|
||||
;; hungry-delete
|
||||
@@ -366,6 +369,21 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
||||
;; dashboard
|
||||
(global-set-key (kbd "C-c D") 'dashboard-open)
|
||||
|
||||
;; dired
|
||||
(with-eval-after-load 'dirvish
|
||||
(global-set-key (kbd "C-c d a") 'dirvish-quick-access)
|
||||
(global-set-key (kbd "C-c d s") 'dirvish-side)
|
||||
(global-set-key (kbd "C-c d h") 'dirvish-history-menu)
|
||||
(global-set-key (kbd "C-x d") 'dired-jump)
|
||||
(global-set-key (kbd "C-x C-j") 'dired)
|
||||
(define-key dired-mode-map (kbd "h") 'dirvish-history-menu)
|
||||
(define-key dired-mode-map (kbd "M-,") 'scroll-other-window-down)
|
||||
(define-key dired-mode-map (kbd "M-.") 'scroll-other-window))
|
||||
|
||||
;; perspective
|
||||
(global-set-key (kbd "C-M-<left>") 'persp-prev)
|
||||
(global-set-key (kbd "C-M-<right>") 'persp-next)
|
||||
|
||||
(provide 'init-kbd)
|
||||
|
||||
;;; init-kbd.el ends here
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
(use-package org-journal
|
||||
:config
|
||||
(setq org-journal-file-format "%Y-%m-%d.org"
|
||||
org-journal-file-header "#+title: Daily Journal\n#+category: journal\n#+STARTUP: content\n\n"
|
||||
org-journal-file-header "#+category: journal\n#+STARTUP: content\n\n"
|
||||
org-journal-time-prefix "\n*** TODO "
|
||||
org-journal-time-format "%m-%d \n:PROPERTIES:\n:Created: <%Y-%m-%d %a %H:%M:%S>\n:END:\n"
|
||||
org-journal-hide-entries-p t
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
;; 安装gcmh用于管理内存回收
|
||||
(use-package gcmh
|
||||
:demand t
|
||||
;; :demand t
|
||||
:init
|
||||
(setq gcmh-idle-delay 'auto
|
||||
gcmh-auto-idle-delay-factor 10
|
||||
|
||||
@@ -80,6 +80,17 @@
|
||||
"di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46")
|
||||
(setenv "GIT_CONFIG_GLOBAL" (expand-file-name "~/.emacs.d/.gitconfig-eshell"))))
|
||||
|
||||
(use-package indent-bars
|
||||
:custom
|
||||
(indent-bars-color '(font-lock-comment-face :face-bg nil :blend 0.4))
|
||||
(indent-bars-highlight-current-depth '(:face default :blend 0.4))
|
||||
(indent-bars-pattern ".")
|
||||
(indent-bars-width-frac 0.1)
|
||||
(indent-bars-pad-frac 0.1)
|
||||
(indent-bars-color-by-depth nil)
|
||||
(indent-bars-no-descend-string t)
|
||||
(indent-bars-prefer-character t))
|
||||
|
||||
;; 高亮当前行
|
||||
(global-hl-line-mode t)
|
||||
|
||||
|
||||
26
lisp/init-workspace.el
Normal file
26
lisp/init-workspace.el
Normal file
@@ -0,0 +1,26 @@
|
||||
;;; init-workspace.el --- workspace -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(use-package perspective
|
||||
:bind
|
||||
("C-x M-b" . persp-list-buffers) ; or use a nicer switcher, see below
|
||||
:custom
|
||||
(persp-mode-prefix-key (kbd "C-c p")) ; pick your own prefix key here
|
||||
:init
|
||||
(persp-mode)
|
||||
:config
|
||||
(setq persp-switch-to-buffer-behavior 'switch)
|
||||
(with-eval-after-load 'consult
|
||||
(consult-customize consult-source-buffer :hidden t :default nil)
|
||||
(add-to-list 'consult-buffer-sources persp-consult-source))
|
||||
(setq switch-to-prev-buffer-skip
|
||||
(lambda (win buff bury-or-kill)
|
||||
(not (persp-is-current-buffer buff))))
|
||||
)
|
||||
|
||||
(provide 'init-workspace)
|
||||
|
||||
;;; init-workspace.el ends here
|
||||
@@ -31,6 +31,10 @@
|
||||
`(dashboard-footer-face ((,class (:foreground ,blue))))
|
||||
`(dashboard-text-banner ((,class (:foreground ,green))))
|
||||
`(dashboard-heading ((,class (:foreground ,green :weight bold))))
|
||||
`(dirvish-file-time ((,class (:foreground ,base01))))
|
||||
`(dired-header ((,class (:foreground ,green))))
|
||||
`(mode-line ((,class (:foreground ,base0 :background ,base02))))
|
||||
`(mode-line-inactive ((,class (:foreground ,base01 :background ,base03))))
|
||||
`(vertico-current ((,class (:background ,base02 :extend t :underline nil)))))))
|
||||
|
||||
(provide-theme 'my-base16-dark)
|
||||
|
||||
Reference in New Issue
Block a user