本技能用于配置 lazygit 这款 git 终端界面(TUI),重点解决 config.yml 设置、custom pagers(尤其是 delta 集成)、主题、键位绑定与自定义命令。核心思路是最小配置:只覆盖需要改动的项。配置文件位置:macOS 为 ~/Library/Application Support/lazygit/config.yml,Linux 为 ~/.config/lazygit/config.yml,Windows 为 %LOCALAPPDATA%\lazygit\config.yml;旧版安装路径为各自的 jesseduffield 子目录。仓库级覆盖可用父目录下的 .lazygit.yml 或 <repo>/.git/lazygit.yml,仓库配置优先于全局。配置分为 gui、git、os、keybinding、customCommands 等 YAML 段。delta 集成方式:先安装(如 brew install git-delta、nix profile install nixpkgs#delta),再在 lazygit 的 git.paging 中设 colorArg: always、pager: delta --dark --paging=never,并在 ~/.gitconfig 配置 core.pager、interactive.diffFilter 及 delta 主题、行号、导航等;delta 的配置位于 ~/.gitconfig 而非 lazygit 配置中。可配置多个 pagers 并用 | 键循环切换,也支持 difftastic 等 externalDiffCommand。主题与键位可分别通过 gui.theme 和 keybinding.universal 及 files、branches 等上下文段调整。自定义命令支持 key、command、description、context、loadingText、subprocess 及 prompts 输入。常用命令:lazygit --print-config-dir、which delta、delta --version、git diff | delta。限制:具体默认值、可用主题、自定义命令细节需以所提供资料为准;资料未提供价格、平台支持范围或效果数据。
lazygit-config
编程与开发
更新于 10-16 06:44