A config/pkg-git.el => config/pkg-git.el +41 -0
@@ 0,0 1,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