Add 16 files (16+ files changed)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# ~/.zlogin: Executed for LOGIN shells, AFTER .zshrc has loaded.
|
||||
# Use for final tasks that require the full environment to be ready (e.g., welcome messages, mail checks).
|
||||
# Rarely needed for standard configuration.
|
||||
|
||||
[[ -f $HOME/.zshrc.local ]] || touch $HOME/.zshrc.local
|
||||
source $HOME/.zshrc.local
|
||||
|
||||
if [[ $FFENABLED != "false" ]] && command -v fastfetch >/dev/null; then
|
||||
fastfetch --config examples/13
|
||||
fi
|
||||
@@ -0,0 +1,2 @@
|
||||
# ~/.zlogout: Executed when a LOGIN shell exits.
|
||||
# Use for cleanup tasks: resetting terminal titles, stopping agents, or clearing temp files.
|
||||
@@ -0,0 +1,8 @@
|
||||
# ~/.zprofile: Executed once for LOGIN shells (initial terminal/SSH).
|
||||
# Use for one-time setup: PATH modifications, starting agents, or environment exports.
|
||||
# Runs BEFORE .zshrc. Ideal for variables that shouldn't be re-evaluated in every sub-shell.
|
||||
|
||||
[[ -d "$HOME/Scripts" ]] && path+=("$HOME/Scripts")
|
||||
[[ -d "$HOME/.local/bin" ]] && path+=("$HOME/.local/bin")
|
||||
[[ -d "$HOME/AppImages" ]] && path+=("$HOME/AppImages")
|
||||
[[ -d "$HOME/.opencode/bin" ]] && path+=("$HOME/.opencode/bin")
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
# frameworks like oh-my-zsh are supported
|
||||
getantidote/use-omz # handle OMZ dependencies
|
||||
ohmyzsh/ohmyzsh path:lib # load OMZ's library
|
||||
|
||||
using:ohmyzsh/ohmyzsh path:plugins
|
||||
git
|
||||
sudo
|
||||
extract
|
||||
eza
|
||||
history
|
||||
kitty
|
||||
docker
|
||||
docker-compose
|
||||
archlinux
|
||||
encode64
|
||||
universalarchive
|
||||
fzf
|
||||
systemd
|
||||
vscode
|
||||
rsync
|
||||
|
||||
# popular fish-like plugins
|
||||
zsh-users/zsh-autosuggestions
|
||||
zdharma-continuum/fast-syntax-highlighting kind:defer
|
||||
zsh-users/zsh-history-substring-search
|
||||
Aloxaf/fzf-tab
|
||||
@@ -0,0 +1,9 @@
|
||||
# ~/.zshrc: Executed for EVERY INTERACTIVE shell (terminal tabs/windows).
|
||||
# Use for aliases, functions, prompt themes, key bindings, and shell options (setopt).
|
||||
# This is where 90% of your customization belongs.
|
||||
|
||||
source ${ZDOTDIR}/init.zsh
|
||||
source ${ZDOTDIR}/aliases.zsh
|
||||
source ${ZDOTDIR}/functions.zsh
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
@@ -0,0 +1,27 @@
|
||||
_hl_flag="--hyperlink"
|
||||
if command -v eza >/dev/null && eza --help 2>&1 | grep -q -- '--hyperlink.*<WHEN>'; then
|
||||
_hl_flag="--hyperlink=always"
|
||||
fi
|
||||
for _ea in la ldot lD lDD ll ls lsd lsdl lS lT; do
|
||||
(( $+aliases[$_ea] )) && alias "$_ea"="${aliases[$_ea]} $_hl_flag"
|
||||
done
|
||||
unset _ea _hl_flag
|
||||
|
||||
# bat: colored `cat` and colored man pages. bat/batcat handled by bootstrap.
|
||||
if command -v bat >/dev/null; then
|
||||
alias cat='bat'
|
||||
export BAT_THEME="${BAT_THEME:-Monokai Extended}"
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
export MANROFFOPT='-c'
|
||||
fi
|
||||
|
||||
# delta: prettier git diffs as git's pager (git respects GIT_PAGER). Auto-installed
|
||||
# by the bootstrap. Not aliased to `diff` since delta reads diff input on stdin,
|
||||
# not two file arguments — GIT_PAGER is the correct integration.
|
||||
command -v delta >/dev/null && export GIT_PAGER='delta'
|
||||
|
||||
alias c='clear'
|
||||
alias q="exit"
|
||||
alias nbstat=$'netbird status --json | jq -r \'.peers.details[]? | [(.hostname // .fqdn), .netbirdIp, .status] | @tsv\' | column -t -s $\'\\t\''
|
||||
alias open-ports="ss -tulpn | grep LISTEN"
|
||||
alias yeet='yay -Rcs'
|
||||
Executable
+138
@@ -0,0 +1,138 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# --- Helpers ---
|
||||
|
||||
info() { printf "\033[1;34m%s\033[0m\n" "$*"; }
|
||||
warn() { printf "\033[1;33m%s\033[0m\n" "$*"; }
|
||||
error() { printf "\033[1;31m%s\033[0m\n" "$*"; }
|
||||
|
||||
arch() {
|
||||
case "$(uname -m)" in
|
||||
x86_64) echo "x86_64" ;;
|
||||
aarch64) echo "aarch64" ;;
|
||||
armv7l) echo "armhf" ;;
|
||||
*) echo "unknown" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# --- Check existing ---
|
||||
|
||||
check_all() {
|
||||
local missing=()
|
||||
for cmd in git curl jq fzf starship eza bat delta fastfetch dotstate; do
|
||||
command -v "$cmd" &>/dev/null || missing+=("$cmd")
|
||||
done
|
||||
if [[ ${#missing[@]} -eq 0 ]]; then
|
||||
info "all tools present" >&2
|
||||
exit 0
|
||||
fi
|
||||
echo "${missing[@]}"
|
||||
}
|
||||
|
||||
MISSING=($(check_all))
|
||||
[[ ${#MISSING[@]} -eq 0 ]] && exit 0
|
||||
|
||||
# --- Detect package manager ---
|
||||
|
||||
install_pkgs() {
|
||||
if command -v pacman &>/dev/null; then
|
||||
sudo pacman -S --noconfirm "$@"
|
||||
elif command -v dnf &>/dev/null; then
|
||||
sudo dnf install -y "$@"
|
||||
elif command -v apt &>/dev/null; then
|
||||
sudo apt update -qq && sudo apt install -y "$@"
|
||||
elif command -v zypper &>/dev/null; then
|
||||
sudo zypper install -y "$@"
|
||||
elif command -v apk &>/dev/null; then
|
||||
sudo apk add "$@"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# --- Install from system repos ---
|
||||
|
||||
SYS_pkgs=()
|
||||
BIN_pkgs=()
|
||||
|
||||
# Map tool names to distro package names where they differ
|
||||
declare -A PKG_NAMES=(
|
||||
[git]="git"
|
||||
[curl]="curl"
|
||||
[jq]="jq"
|
||||
[fzf]="fzf"
|
||||
[eza]="eza"
|
||||
[bat]="bat"
|
||||
[delta]="git-delta"
|
||||
[fastfetch]="fastfetch"
|
||||
)
|
||||
|
||||
# starship and dotstate have no distro package, always binary
|
||||
for tool in "${MISSING[@]}"; do
|
||||
if [[ "$tool" == "starship" || "$tool" == "dotstate" ]]; then
|
||||
BIN_pkgs+=("$tool")
|
||||
continue
|
||||
fi
|
||||
pkg="${PKG_NAMES[$tool]:-$tool}"
|
||||
SYS_pkgs+=("$pkg")
|
||||
done
|
||||
|
||||
if [[ ${#SYS_pkgs[@]} -gt 0 ]]; then
|
||||
info "installing from system repos: ${SYS_pkgs[*]}"
|
||||
install_pkgs "${SYS_pkgs[@]}" || {
|
||||
warn "system install failed, falling back to binaries"
|
||||
BIN_pkgs+=("${SYS_pkgs[@]}")
|
||||
}
|
||||
fi
|
||||
|
||||
# --- Install pre-built binaries ---
|
||||
|
||||
install_binary() {
|
||||
local name="$1"
|
||||
local arch
|
||||
arch=$(arch)
|
||||
|
||||
case "$name" in
|
||||
starship)
|
||||
info "installing starship"
|
||||
curl -sS https://starship.rs/install.sh | sh -s -- -y
|
||||
;;
|
||||
eza)
|
||||
info "installing eza"
|
||||
local url="https://github.com/eza-community/eza/releases/latest/download/eza-${arch}-unknown-linux-musl.tar.gz"
|
||||
curl -sSfL "$url" | sudo tar xz -C /usr/local/bin
|
||||
;;
|
||||
bat)
|
||||
info "installing bat"
|
||||
local url="https://github.com/sharkdp/bat/releases/latest/download/bat-${arch}-unknown-linux-musl.tar.gz"
|
||||
curl -sSfL "$url" | sudo tar xz --strip-components=1 -C /usr/local/bin "bat-${arch}-unknown-linux-musl/bat"
|
||||
;;
|
||||
delta)
|
||||
info "installing delta"
|
||||
local url="https://github.com/dandavison/delta/releases/latest/download/delta-${arch}-unknown-linux-musl.tar.gz"
|
||||
curl -sSfL "$url" | sudo tar xz --strip-components=1 -C /usr/local/bin "delta-${arch}-unknown-linux-musl/delta"
|
||||
;;
|
||||
fastfetch)
|
||||
info "installing fastfetch"
|
||||
local url="https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-${arch}.tar.gz"
|
||||
curl -sSfL "$url" | sudo tar xz --strip-components=2 -C /usr/local/bin
|
||||
;;
|
||||
jq)
|
||||
info "installing jq"
|
||||
local url="https://github.com/jqlang/jq/releases/latest/download/jq-linux-${arch}"
|
||||
curl -sSfL "$url" -o /usr/local/bin/jq
|
||||
sudo chmod +x /usr/local/bin/jq
|
||||
;;
|
||||
dotstate)
|
||||
info "installing dotstate"
|
||||
curl -fsSL https://dotstate.serkan.dev/install.sh | bash
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
for tool in "${BIN_pkgs[@]}"; do
|
||||
install_binary "$tool"
|
||||
done
|
||||
|
||||
info "done"
|
||||
@@ -0,0 +1,7 @@
|
||||
fix_btopbg(){
|
||||
sed -i 's/theme_background = true/theme_background = false/' ~/.config/btop/btop.conf
|
||||
}
|
||||
|
||||
install_opencode(){
|
||||
curl -fsSL https://opencode.ai/install | bash
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
# first, run this from an interactive zsh terminal session:
|
||||
if [[ -e "${ZDOTDIR}/.antidote" && ! -d "${ZDOTDIR}/.antidote" ]]; then
|
||||
mkdir -p "${ZDOTDIR}/.antidote" && chmod 700 "${ZDOTDIR}/.antidote"
|
||||
git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR}/.antidote
|
||||
fi
|
||||
|
||||
zsh_plugins=${ZDOTDIR}/.zsh_plugins
|
||||
[[ -f ${zsh_plugins}.txt ]] || touch ${zsh_plugins}.txt
|
||||
|
||||
# source antidote
|
||||
source ${ZDOTDIR}/.antidote/antidote.zsh
|
||||
|
||||
# Eza plugin options
|
||||
zstyle ':omz:plugins:eza' dirs-first yes
|
||||
zstyle ':omz:plugins:eza' git-status yes
|
||||
zstyle ':omz:plugins:eza' header yes
|
||||
zstyle ':omz:plugins:eza' show-group yes
|
||||
zstyle ':omz:plugins:eza' icons yes
|
||||
zstyle ':omz:plugins:eza' color-scale all
|
||||
zstyle ':omz:plugins:eza' color-scale-mode fixed
|
||||
zstyle ':omz:plugins:eza' size-prefix si
|
||||
# Note: 'hyperlink' is omitted as per your comment
|
||||
|
||||
# Completion settings
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
||||
|
||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
# Ensure directories exist
|
||||
mkdir -p "$XDG_CACHE_HOME/zsh"
|
||||
|
||||
export HISTFILE="$XDG_CACHE_HOME/zsh/history"
|
||||
export ZSH_COMPDUMP="$XDG_CACHE_HOME/zsh/zcompdump-${HOST}-${ZSH_VERSION}"
|
||||
export HISTSIZE=10000
|
||||
export SAVEHIST=10000
|
||||
|
||||
setopt SHARE_HISTORY
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
setopt HIST_FCNTL_LOCK
|
||||
setopt AUTO_CD
|
||||
setopt AUTO_LIST
|
||||
setopt INTERACTIVE_COMMENTS
|
||||
setopt HIST_VERIFY
|
||||
setopt EXTENDED_HISTORY
|
||||
setopt AUTO_PUSHD
|
||||
setopt PUSHD_IGNORE_DUPS
|
||||
setopt PUSHD_SILENT
|
||||
|
||||
# initialize plugins statically with ${ZDOTDIR:-$HOME}/.zsh_plugins.txt
|
||||
antidote load
|
||||
Reference in New Issue
Block a user