diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2023-08-15 13:53:03 -0400 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2023-08-15 13:53:03 -0400 |
| commit | baa1a3193e6f98c11cb5eb8ee66d4c5ae7255d56 (patch) | |
| tree | 57be22a5713ab1ba591778f66c6287713b484cf9 | |
| parent | 10a256758a5b8c5c3862357945537d56ea350f89 (diff) | |
switch to yash
| -rw-r--r-- | .config/fish/config.fish | 12 | ||||
| -rw-r--r-- | .config/fish/fish_variables | 31 | ||||
| -rw-r--r-- | .config/fish/functions/fish_prompt.fish | 86 | ||||
| -rw-r--r-- | .config/fish/themes/macchiato.theme | 29 | ||||
| -rw-r--r-- | .profile | 22 | ||||
| -rw-r--r-- | .yashrc | 83 |
6 files changed, 97 insertions, 166 deletions
diff --git a/.config/fish/config.fish b/.config/fish/config.fish deleted file mode 100644 index 9774f7f..0000000 --- a/.config/fish/config.fish +++ /dev/null @@ -1,12 +0,0 @@ -if status is-interactive - atuin init fish | sed '/^bind.*_atuin_bind_up/d' | source -end - -alias parallel parallel-moreutils -alias cfg 'git --git-dir $HOME/.cfg --work-tree $HOME' - -# pnpm -set -gx PNPM_HOME "/home/samn/.local/share/pnpm" -if not string match -q -- $PNPM_HOME $PATH - set -gx PATH "$PNPM_HOME" $PATH -end diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables deleted file mode 100644 index 1a82b8a..0000000 --- a/.config/fish/fish_variables +++ /dev/null @@ -1,31 +0,0 @@ -# This file contains fish universal variable definitions. -# VERSION: 3.0 -SETUVAR __fish_initialized:3400 -SETUVAR fish_color_autosuggestion:555\x1ebrblack -SETUVAR fish_color_cancel:\x2dr -SETUVAR fish_color_command:blue -SETUVAR fish_color_comment:red -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:green -SETUVAR fish_color_error:brred -SETUVAR fish_color_escape:brcyan -SETUVAR fish_color_history_current:\x2d\x2dbold -SETUVAR fish_color_host:normal -SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:brcyan -SETUVAR fish_color_param:cyan -SETUVAR fish_color_quote:yellow -SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold -SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_status:red -SETUVAR fish_color_user:brgreen -SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_completion:normal -SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di -SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline -SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish deleted file mode 100644 index 494b07f..0000000 --- a/.config/fish/functions/fish_prompt.fish +++ /dev/null @@ -1,86 +0,0 @@ -function fish_prompt - set -l cmd_status $status - set -l cmd_duration (math -s0 $CMD_DURATION / 1000) - set CMD_DURATION 0 - set -l is_git (git rev-parse --is-inside-work-tree 2>/dev/null) - - echo - - set_color --bold cyan - if [ "$is_git" = true ] - printf "%s" (git rev-parse --show-toplevel | awk -F/ '{ print $NF }') - set -l git_path (git rev-parse --show-prefix | sed 's#/$##') - [ -n "$git_path" ] && printf '/%s' $git_path - else - printf (prompt_pwd -d0) - end - set_color normal - - if [ "$is_git" = true ] - printf " on " - set_color --bold magenta - printf " "(git branch --show-current) - - function git_status - set -l s (git status --porcelain -b | string split0) - - git rev-parse --verify refs/stash &>/dev/null && printf '$' - echo $s | grep -q '^U[UDA]|^AA|^DD|^[DA]U' && printf "=" - echo $s | grep -q '^[MARCDU ]D|^D[ UM]' && printf "✘" - echo $s | grep -q '^R[ MD]' && printf "»" - echo $s | grep -q '^[ MARC]M' && printf "!" - echo $s | grep -q '^A[ MDAU]|^M[ MD]|^UA' && printf "+" - echo $s | grep -q '^\?\?' && printf "?" - - set -l ahead (echo $s | grep -q '^## [^ ]\+ .*ahead'; echo $status) - set -l behind (echo $s | grep -q '^## [^ ]\+ .*behind'; echo $status) - if [ "$ahead" -eq 0 ] && [ "$behind" -eq 0 ] - printf "⇕" - elif [ "$ahead" -eq 0 ] - printf "⇡" - elif [ "$behind" -eq 0 ] - printf "⇣" - end - end - - set -l stat (git_status) - if [ -n "$stat" ] - set_color --bold red - printf " [%s]" "$stat" - end - - set_color normal - end - - if [ "$cmd_duration" -gt 1 ] - printf " took" - set_color --bold yellow - - set -l secs (math -s1 $cmd_duration % 60) - set -l mins (math -s0 $cmd_duration / 60 % 60) - set -l hours (math -s0 $cmd_duration / 3600) - - [ "$hours" -gt 0 ] && printf " %dh" "$hours" - [ "$mins" -gt 0 ] && printf " %dm" "$mins" - [ "$secs" -gt 0 ] && printf " %ds" "$secs" - set_color normal - end - - echo - - if jobs &>/dev/null - set -l jobs (jobs | wc -l) - set_color --bold blue - printf "✦ " - [ "$jobs" -gt 1 ] && printf "%d " "$jobs" - set_color normal - end - - if [ "$cmd_status" -eq 0 ] - set_color green - else - set_color red - end - printf "❯ " - set_color normal -end diff --git a/.config/fish/themes/macchiato.theme b/.config/fish/themes/macchiato.theme deleted file mode 100644 index bed45c9..0000000 --- a/.config/fish/themes/macchiato.theme +++ /dev/null @@ -1,29 +0,0 @@ -# name: 'Catppuccin macchiato' -# url: 'https://github.com/catppuccin/fish' -# preferred_background: 24273a - -fish_color_normal cad3f5 -fish_color_command 8aadf4 -fish_color_param f0c6c6 -fish_color_keyword ed8796 -fish_color_quote a6da95 -fish_color_redirection f5bde6 -fish_color_end f5a97f -fish_color_comment 8087a2 -fish_color_error ed8796 -fish_color_gray 6e738d -fish_color_selection --background=363a4f -fish_color_search_match --background=363a4f -fish_color_operator f5bde6 -fish_color_escape ee99a0 -fish_color_autosuggestion 6e738d -fish_color_cancel ed8796 -fish_color_cwd eed49f -fish_color_user 8bd5ca -fish_color_host 8aadf4 -fish_color_host_remote a6da95 -fish_color_status ed8796 -fish_pager_color_progress 6e738d -fish_pager_color_prefix f5bde6 -fish_pager_color_completion cad3f5 -fish_pager_color_description 6e738d @@ -1,4 +1,5 @@ -# Add PATH entries, we can't use external commands yet in case PATH is empty +# Add PATH entries if they aren't already in PATH +# We can't use external commands yet in case PATH is empty for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin "$HOME"/.local/bin "$HOME"/.cargo/bin "$HOME"/bin; do case ":$PATH:" in *:"$p":*) ;; @@ -7,18 +8,23 @@ for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin "$HOME"/.l done # Create a tmpdir for XDG_RUNTIME_DIR if it is not set -[ "$XDG_RUNTIME_DIR" ] || export XDG_RUNTIME_DIR=$(mktemp -d) +if ! [ "$XDG_RUNTIME_DIR" ]; then + rundir="/run/user/$(id -u)" + if [ -d "$rundir" ]; then + export XDG_RUNTIME_DIR="$rundir" + else + XDG_RUNTIME_DIR="$(mktemp -d)" + export XDG_RUNTIME_DIR + fi +fi # Set environment variables -export EDITOR=nvim +export EDITOR=vim +export VISUAL=vim export PAGER=less +export SHELL=yash export TERMINAL=foot export BROWSER=firefox export GTK_THEME=Catppuccin-Macchiato-Standard-Mauve-Dark export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR"/hissh-agent export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR"/bus -export FZF_DEFAULT_OPTS=" \ - --color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \ - --color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \ - --color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796" - @@ -0,0 +1,83 @@ +_ps1_prompt() { + cmd_status=$? + cmd_duration=$((CMD_DURATION / 1000)) + CMD_DURATION=0 + is_git=$(git rev-parse --is-inside-work-tree 2>/dev/null) + + printf '\n\\foc.' + if [ "$is_git" ]; then + printf '%s' "$(git rev-parse --show-toplevel | awk -F/ '{ print $NF }')" + git_path=$(git rev-parse --show-prefix) + git_path="${git_path%/}" + [ "$git_path" ] && printf '/%s' "$git_path" + else + printf '%s' "$(pwd | sed "s#^$HOME#~#")" + fi + printf '\\fD.' + + if [ "$is_git" ]; then + printf ' on \\fom. %s' "$(git branch --show-current)" + + stat= + s=$(git status --porcelain -b) + echo "$s" | grep -q '^U[UDA]|^AA|^DD|^[DA]U' && stat="$stat=" + git rev-parse --verify refs/stash >/dev/null 2>&1 && stat="$stat\$" + echo "$s" | grep -q '^[MARCDU ]D|^D[ UM]' && stat="$stat✘" + echo "$s" | grep -q '^R[ MD]' && stat="$stat»" + echo "$s" | grep -q '^[ MARC]M' && stat="$stat!" + echo "$s" | grep -q '^A[ MDAU]|^M[ MD]|^UA' && stat="$stat+" + echo "$s" | grep -q '^\?\?' && stat="$stat?" + + ahead= + behind= + echo "$s" | grep -q '^## [^ ]\+ .*ahead' && ahead=1 + echo "$s" | grep -q '^## [^ ]\+ .*behind' && behind=1 + if [ "$ahead" ] && [ "$behind" ]; then + stat="$stat⇕" + elif [ "$ahead" ]; then + stat="$stat⇡" + elif [ "$behind" ]; then + stat="$stat⇣" + fi + + if [ "$stat" ]; then + printf '\\for. [%s]' "$stat" + fi + fi + + if [ "$cmd_duration" -gt 1 ]; then + printf ' took\\foy.' + + secs=$((cmd_duration % 60)) + mins=$((cmd_duration / 60 % 60)) + hours=$((cmd_duration / 3600)) + + [ "$hours" -gt 0 ] && printf ' %dh' "$hours" + [ "$mins" -gt 0 ] && printf ' %dm' "$mins" + [ "$secs" -gt 0 ] && printf ' %ds' "$secs" + fi + printf '\\fD.\n' + + n_jobs="$(jobs 2>/dev/null | wc -l)" + if [ "$n_jobs" -gt 0 ]; then + printf '\\fob.✦ ' + [ "$n_jobs" -gt 1 ] && printf '%d ' "$n_jobs" + printf '\\fD.' + fi + + if [ "$cmd_status" -eq 0 ]; then + printf '\\fg.' + else + printf '\\fr.' + fi + printf '❯ \\fD.' +} + +export PS1='$(_ps1_prompt)' + +export HISTSIZE=100000 +export HISTRMDUP=10 + +set le-predict + +alias cfg='git --git-dir ~/.cfg --work-tree ~' |
