harmonize with coredesktop

This commit is contained in:
David Young
2026-10-28 14:35:07 -06:00
parent 866720c3c1
commit 9b9f1d5fdd
35 changed files with 1445 additions and 8 deletions
+31
View File
@@ -0,0 +1,31 @@
# MiniServer aliases, sourced by shell/bashrc
# Files
if command -v eza &> /dev/null; then
alias ls='eza --group-directories-first --icons=auto'
alias ll='eza -lh --group-directories-first --icons=auto'
alias la='eza -lha --group-directories-first --icons=auto'
alias lt='eza --tree --level=2 --long --icons=auto --git'
fi
# Fuzzy-find a file with a preview, or open the one you pick in your editor
alias ff="fzf --preview 'bat --style=numbers --color=always {}'"
alias eff='${EDITOR:-nvim} "$(ff)"'
alias decompress='tar -xzf'
# Directories
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
# Tools
alias g='git'
alias lg='lazygit'
alias d='docker'
alias ld='lazydocker'
# Git
alias gcm='git commit -m'
alias gcam='git commit -a -m'
alias gcad='git commit -a --amend'
+42
View File
@@ -0,0 +1,42 @@
# MiniServer shell setup, sourced from ~/.bashrc (added by shell/setup.sh).
# Anything in ~/.bashrc after the line that sources this file overrides it.
# Only for interactive shells
[[ $- != *i* ]] && return
MINISERVER_SHELL="$HOME/.local/share/MiniServer/shell"
# AI agents such as opencode and hermes run sandboxed (see sandbox/agent), so
# sandbox/bin must come before the directories holding their real commands
SANDBOX_BIN="$HOME/.local/share/MiniServer/sandbox/bin"
PATH="$SANDBOX_BIN:${PATH//$SANDBOX_BIN:/}"
# History: keep a lot of it, skip duplicates, and don't let shells overwrite
# each other's history on exit
shopt -s histappend
HISTCONTROL=ignoreboth
HISTSIZE=32768
HISTFILESIZE="$HISTSIZE"
if [[ ! -v BASH_COMPLETION_VERSINFO && -f /usr/share/bash-completion/bash_completion ]]; then
source /usr/share/bash-completion/bash_completion
fi
source "$MINISERVER_SHELL/aliases"
source "$MINISERVER_SHELL/functions"
# Prompt. Uses MiniServer's starship config unless you have your own.
if [[ $TERM != "dumb" ]] && command -v starship &> /dev/null; then
[[ -f "$HOME/.config/starship.toml" ]] || export STARSHIP_CONFIG="$MINISERVER_SHELL/starship.toml"
eval "$(starship init bash)"
fi
# z <part of a path> jumps to a directory you've visited before
if command -v zoxide &> /dev/null; then
eval "$(zoxide init bash)"
fi
# Ctrl-R fuzzy history search, Ctrl-T to insert a file path, Alt-C to cd
if [[ -f /usr/share/fzf/key-bindings.bash ]]; then
source /usr/share/fzf/key-bindings.bash
fi
+78
View File
@@ -0,0 +1,78 @@
# MiniServer shell functions, sourced by shell/bashrc
# n opens Neovim in the current directory, or on the files given
n() { if [ "$#" -eq 0 ]; then command nvim . ; else command nvim "$@"; fi; }
# open a file or URL with its default app, detached from the terminal
open() (
xdg-open "$@" > /dev/null 2>&1 &
)
# compress <dir> makes <dir>.tar.gz (decompress is an alias for tar -xzf)
compress() { tar -czf "${1%/}.tar.gz" "${1%/}"; }
# SSH port forwarding
# fip <host> <port>... forward each localhost port to the same port on host
# dip <port>... stop forwarding those ports
# lip list active forwards
fip() {
(( $# < 2 )) && echo "Usage: fip <host> <port1> [port2] ..." && return 1
local host="$1"
shift
for port in "$@"; do
ssh -f -N -L "${port}:localhost:${port}" "$host" && echo "Forwarding localhost:$port -> $host:$port"
done
}
dip() {
(( $# == 0 )) && echo "Usage: dip <port1> [port2] ..." && return 1
for port in "$@"; do
pkill -f "ssh.*-L ${port}:localhost:${port}" && echo "Stopped forwarding port $port" || echo "No forwarding on port $port"
done
}
lip() {
pgrep -af "ssh.*-L [0-9]+:localhost:[0-9]+" || echo "No active forwards"
}
# Git worktrees
# ga <branch> create ../<repo>--<branch> on a new branch and cd into it
# gd from inside that worktree, remove it and its branch
ga() {
if [[ -z "$1" ]]; then
echo "Usage: ga [branch name]"
return 1
fi
local branch="$1"
local base="$(basename "$PWD")"
local wt_path="../${base}--${branch}"
git worktree add -b "$branch" "$wt_path" || return 1
command -v mise &> /dev/null && mise trust "$wt_path"
cd "$wt_path"
}
gd() {
local cwd base branch root worktree answer
cwd="$(pwd)"
worktree="$(basename "$cwd")"
# split on first `--`
root="${worktree%%--*}"
branch="${worktree#*--}"
# Protect against accidentally nuking a non-worktree directory
if [[ "$root" == "$worktree" ]]; then
echo "Not in a worktree made by ga (expected a <repo>--<branch> directory)."
return 1
fi
read -rp "Remove worktree $worktree and branch $branch? [y/N] " answer
[[ $answer == [yY]* ]] || return 0
cd "../$root"
git worktree remove "$cwd" --force || return 1
git branch -D "$branch"
}
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
#
# Purpose : Hook MiniServer's shell setup (prompt, zoxide, fzf key bindings,
# aliases and functions in shell/) into ~/.bashrc
LINE='[[ -f "$HOME/.local/share/MiniServer/shell/bashrc" ]] && source "$HOME/.local/share/MiniServer/shell/bashrc"'
if grep -qF "$LINE" ~/.bashrc 2>/dev/null; then
echo "MiniServer shell setup already in .bashrc"
else
echo "$LINE" >> ~/.bashrc
echo "MiniServer shell setup added to .bashrc"
fi
+37
View File
@@ -0,0 +1,37 @@
add_newline = true
command_timeout = 200
format = "[$hostname$directory$git_branch$git_status]($style)$character"
[character]
error_symbol = "[✗](bold cyan)"
success_symbol = "[❯](bold cyan)"
[hostname]
ssh_only = false
format = "[$hostname]($style):"
style = "bold cyan"
[directory]
truncation_length = 0
truncate_to_repo = false
repo_root_style = "bold cyan"
repo_root_format = "[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) "
[git_branch]
format = "[$branch]($style) "
style = "italic cyan"
[git_status]
format = '[$all_status]($style)'
style = "cyan"
ahead = "⇡${count} "
diverged = "⇕⇡${ahead_count}⇣${behind_count} "
behind = "⇣${count} "
conflicted = " "
up_to_date = " "
untracked = "? "
modified = " "
stashed = ""
staged = ""
renamed = ""
deleted = ""