~cytrogen/.emacs.d

ref: df10ed13470f3f18a090490bd2680abe65f24ba5 .emacs.d/config/pkg-git.el -rw-r--r-- 1.3 KiB
df10ed13 — Cytrogen feat(calendar): 添加 Google Calendar/Tasks 双向同步 a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;;; pkg-git.el --- Git integration -*- lexical-binding: t -*-

;; Copyright (C) 2026 Cytrogen

;; Many package selections and configurations adapted from
;; Steve Purcell's emacs.d: https://github.com/purcell/emacs.d

;;; Code:

;; Magit — Git 完整操作界面
(unless (package-installed-p 'magit)
  (package-refresh-contents)
  (package-install 'magit))

;; 绑定 C-x p m — magit-project-status 已由 magit autoloads 注册
(keymap-set project-prefix-map "m" #'magit-project-status)

;; Diff-hl — 边栏显示 git 增删改
(unless (package-installed-p 'diff-hl)
  (package-install 'diff-hl))
(require 'diff-hl)
(global-diff-hl-mode 1)
(add-hook 'dired-mode-hook 'diff-hl-dired-mode)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)

;; Git-timemachine — 逐版本浏览文件历史
(unless (package-installed-p 'git-timemachine)
  (package-install 'git-timemachine))

;; Ibuffer-vc — ibuffer 按版本控制项目分组
(unless (package-installed-p 'ibuffer-vc)
  (package-install 'ibuffer-vc))
(global-set-key (kbd "C-x C-b") 'ibuffer)
(add-hook 'ibuffer-hook
          (lambda ()
            (ibuffer-vc-set-filter-groups-by-vc-root)
            (unless (eq ibuffer-sorting-mode 'alphabetic)
              (ibuffer-do-sort-by-alphabetic))))

(provide 'pkg-git)
;;; pkg-git.el ends here