Git Bash 配置
.bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
.bashrc
# =========================
# 基础配置
# =========================
export HISTSIZE=10000
export HISTFILESIZE=20000
shopt -s histappend
shopt -s cmdhist
export HISTCONTROL=ignoredups:erasedups
# =========================
# Bash Completion
# =========================
if [ -f /usr/share/bash-completion/bash_completion ]; then
source /usr/share/bash-completion/bash_completion
fi
# =========================
# Git Completion
# =========================
if [ -f /usr/share/git/completion/git-completion.bash ]; then
source /usr/share/git/completion/git-completion.bash
fi
# =========================
# FZF
# =========================
if command -v fzf >/dev/null 2>&1; then
eval "$(fzf --bash)"
fi
# =========================
# Zoxide
# =========================
if command -v zoxide >/dev/null 2>&1; then
eval "$(zoxide init bash)"
fi
# =========================
# Atuin
# =========================
if command -v atuin >/dev/null 2>&1; then
eval "$(atuin init bash)"
fi
# =========================
# Starship
# =========================
if command -v starship >/dev/null 2>&1; then
eval "$(starship init bash)"
fi
# =========================
# Eza
# =========================
if command -v eza >/dev/null 2>&1; then
alias ls='eza --icons'
alias ll='eza -lah --icons'
alias la='eza -a --icons'
alias tree='eza --tree --icons'
fi
# =========================
# Bat
# =========================
if command -v bat >/dev/null 2>&1; then
alias cat='bat --paging=never'
fi
# =========================
# 常用 Alias
# =========================
alias c='clear'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gl='git log --oneline --graph --decorate'
# =========================
# 常用函数
# =========================
# 模糊搜索文件
ff() {
local file
file=$(fzf)
if [ -n "$file" ]; then
echo "$file"
fi
}
# 模糊搜索并用 VSCode 打开
vf() {
local file
file=$(fzf)
if [ -n "$file" ]; then
code "$file"
fi
}
简化版本的 toml配置
"$schema" = 'https://starship.rs/config-schema.json'
scan_timeout = 10
command_timeout = 100
add_newline = false
format = "$time $directory$git_branch $character"
[time]
disabled = false
format = "[$time]($style)"
time_format = "%H:%M:%S"
style = "dimmed"
[directory]
style = "cyan"
truncation_length = 3
truncate_to_repo = true
[git_branch]
format = " [$branch]($style)"
style = "purple"
[character]
success_symbol = "[❯](green)"
error_symbol = "[❯](red)"