Compare commits

..

4 Commits

2 changed files with 54 additions and 1 deletions

View File

@@ -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

View 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