dotfiles v1.1.0
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
# DOTFILES_DIR holds the template files; DOTFILES_BACKUP_DIR holds backups
|
||||
# and the last-update-check timestamp.
|
||||
|
||||
set -g DOTFILES_VERSION "1.0.10"
|
||||
set -g DOTFILES_VERSION "1.1.0"
|
||||
|
||||
# --- Remote repository (set this to enable auto-updates) --------------------
|
||||
# Example:
|
||||
@@ -134,12 +134,6 @@ if status is-interactive
|
||||
end
|
||||
end
|
||||
|
||||
# ── 4c. Prompt ─────────────────────────────────────────────────────────
|
||||
# No custom fish_prompt defined here — Fish uses its built-in default
|
||||
# which shows user@host in color, the working directory, git status,
|
||||
# and pipestatus. To customise, define your own fish_prompt function
|
||||
# in ~/.config/fish/functions/fish_prompt.fish.
|
||||
|
||||
end # status is-interactive
|
||||
|
||||
function last_history_item
|
||||
|
||||
37
.config/fish/functions/fish_prompt.fish
Normal file
37
.config/fish/functions/fish_prompt.fish
Normal file
@@ -0,0 +1,37 @@
|
||||
function fish_prompt
|
||||
set -l last_exit $status
|
||||
set -l user (whoami)
|
||||
set -l host (hostname -s)
|
||||
set -l pwd_str (prompt_pwd)
|
||||
echo -n (set_color brblack)"╭─"(set_color normal)
|
||||
echo -n (set_color red)"["(set_color brgreen)"$user"(set_color bryellow)"@"(set_color bryellow)"$host"(set_color red)"]"(set_color normal)
|
||||
echo -n (set_color brblack)" · "(set_color normal)
|
||||
echo -n (set_color --bold green)"$pwd_str"(set_color normal)
|
||||
|
||||
set -l git_branch (command git symbolic-ref --short HEAD 2>/dev/null)
|
||||
if test -n "$git_branch"
|
||||
set -l git_dirty (command git status --porcelain 2>/dev/null | head -c1 | wc -c)
|
||||
echo -n (set_color brblack)" · "(set_color normal)
|
||||
if test "$git_dirty" -gt 0
|
||||
echo -n (set_color red)"["(set_color yellow)"$git_branch"(set_color red)"*]"(set_color normal)
|
||||
else
|
||||
echo -n (set_color green)"["(set_color brgreen)"$git_branch"(set_color green)"]"(set_color normal)
|
||||
end
|
||||
end
|
||||
|
||||
if test $last_exit -ne 0
|
||||
echo -n (set_color brblack)" · "(set_color normal)
|
||||
echo -n (set_color red)"[$last_exit]"(set_color normal)
|
||||
end
|
||||
|
||||
echo
|
||||
echo -n (set_color brblack)"╰─"(set_color normal)
|
||||
|
||||
if test (id -u) -eq 0
|
||||
echo -n (set_color red)"# "(set_color normal)
|
||||
else if test $last_exit -eq 0
|
||||
echo -n (set_color brred)"> "(set_color normal)
|
||||
else
|
||||
echo -n (set_color brred)"> "(set_color normal)
|
||||
end
|
||||
end
|
||||
24
.config/fish/functions/fish_right_prompt.fish
Normal file
24
.config/fish/functions/fish_right_prompt.fish
Normal file
@@ -0,0 +1,24 @@
|
||||
function fish_right_prompt
|
||||
set -l parts
|
||||
|
||||
set -l jobs (jobs -p | wc -l)
|
||||
if test "$jobs" -gt 0
|
||||
set -a parts (set_color brblack)"[$jobs job(s)]"(set_color normal)
|
||||
end
|
||||
|
||||
if set -q VIRTUAL_ENV
|
||||
set -a parts (set_color 666666)"(venv)"(set_color normal)
|
||||
end
|
||||
|
||||
if set -q CONDA_DEFAULT_ENV
|
||||
set -a parts (set_color 666666)"(conda: $CONDA_DEFAULT_ENV)"(set_color normal)
|
||||
end
|
||||
|
||||
if set -q SSH_CONNECTION
|
||||
set -a parts (set_color 666666)"(ssh)"(set_color normal)
|
||||
end
|
||||
|
||||
if set -q parts[1]
|
||||
string join ' ' $parts
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user