Compare commits
4 Commits
b7478f27e0
...
c7e31a1133
| Author | SHA1 | Date | |
|---|---|---|---|
| c7e31a1133 | |||
| b2c919f63f | |||
| 2baa4fdc45 | |||
| 4d31154195 |
@@ -1,10 +1,16 @@
|
|||||||
if status is-interactive
|
if status is-interactive
|
||||||
# Abbreviations (only when target commands exist)
|
# ========= 命令缩写(仅当目标命令存在)=========
|
||||||
|
# ls:优先 eza,其次 exa
|
||||||
if type -q eza
|
if type -q eza
|
||||||
abbr ls eza
|
abbr ls eza
|
||||||
|
abbr ll eza -l
|
||||||
|
abbr la eza -a
|
||||||
else if type -q exa
|
else if type -q exa
|
||||||
abbr ls exa
|
abbr ls exa
|
||||||
|
abbr ll exa -l
|
||||||
|
abbr la exa -a
|
||||||
end
|
end
|
||||||
|
|
||||||
type -q bat; and abbr cat bat
|
type -q bat; and abbr cat bat
|
||||||
type -q bat; and abbr cap bat -p
|
type -q bat; and abbr cap bat -p
|
||||||
type -q fd; and abbr find fd
|
type -q fd; and abbr find fd
|
||||||
@@ -13,9 +19,22 @@ if status is-interactive
|
|||||||
type -q tldr; and abbr help tldr
|
type -q tldr; and abbr help tldr
|
||||||
type -q chezmoi; and abbr cz chezmoi
|
type -q chezmoi; and abbr cz chezmoi
|
||||||
|
|
||||||
|
# ========= thefuck:自动命令纠错 =========
|
||||||
type -q thefuck; and thefuck --alias | source
|
type -q thefuck; and thefuck --alias | source
|
||||||
|
|
||||||
|
# ========= zoxide:智能目录跳转 =========
|
||||||
|
# 使用 --cmd=cd:让 cd 也具备 zoxide 的跳转能力(交互式对应 cdi)
|
||||||
type -q zoxide; and zoxide init --cmd=cd fish | source
|
type -q zoxide; and zoxide init --cmd=cd fish | source
|
||||||
|
|
||||||
|
# ========= 编辑器/查看器(优先 vim,否则 vi)=========
|
||||||
|
if type -q vim
|
||||||
|
set -gx EDITOR vim
|
||||||
|
set -gx VISUAL vim
|
||||||
|
else if type -q vi
|
||||||
|
set -gx EDITOR vi
|
||||||
|
set -gx VISUAL vi
|
||||||
|
end
|
||||||
|
|
||||||
|
# ========= fastfetch:启动信息显示 =========
|
||||||
type -q fastfetch; and fastfetch
|
type -q fastfetch; and fastfetch
|
||||||
end
|
end
|
||||||
|
|||||||
34
run_onchange_install-packages.sh
Normal file
34
run_onchange_install-packages.sh
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 按存在的包管理器安装依赖包。
|
||||||
|
# 说明:
|
||||||
|
# - 不使用 chezmoi 的 .tmpl 模板语法;通过运行时检测 apt/pacman/dnf。
|
||||||
|
# - 脚本尽量保持幂等(包已安装会自动跳过)。
|
||||||
|
|
||||||
|
SUDO=""
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
if command -v sudo >/dev/null 2>&1; then
|
||||||
|
SUDO="sudo"
|
||||||
|
else
|
||||||
|
echo "需要 sudo 权限才能安装包(当前非 root,且找不到 sudo)。" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v pacman >/dev/null 2>&1; then
|
||||||
|
# Arch/Manjaro:先同步并升级系统,再安装所需包
|
||||||
|
$SUDO pacman -Syu --noconfirm
|
||||||
|
$SUDO pacman -S --noconfirm exa zoxide dust bat btop fd ripgrep fzf tldr
|
||||||
|
elif command -v apt >/dev/null 2>&1; then
|
||||||
|
# Debian/Ubuntu:更新索引后再安装
|
||||||
|
$SUDO apt update -y || true
|
||||||
|
$SUDO apt install -y fzf zoxide ripgrep bat fd-find btop exa
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
# Fedora:更新元数据后再安装
|
||||||
|
$SUDO dnf makecache -y || true
|
||||||
|
$SUDO dnf install -y exa zoxide dust bat btop fd-find ripgrep fzf tldr
|
||||||
|
else
|
||||||
|
echo "未检测到 apt / pacman / dnf,跳过安装。" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
Reference in New Issue
Block a user