Compare commits

..

2 commits

Author SHA1 Message Date
9442614acd update flake 2024-06-28 10:24:06 -05:00
04b948c5e6 fish: display vcs/nix/venv/duration info on right prompt 2024-06-28 10:07:59 -05:00
2 changed files with 56 additions and 23 deletions

View file

@ -9,11 +9,11 @@
}, },
"locked": { "locked": {
"dir": "pkgs/firefox-addons", "dir": "pkgs/firefox-addons",
"lastModified": 1718867615, "lastModified": 1719584439,
"narHash": "sha256-ijBhGG+9MfxqIk0hWk4CGTNvk9PcTFJZfZCHoBI9ecI=", "narHash": "sha256-GFc6v+Xcf4cflul5K08inTCVWNnDPdvAwiyVqRpdqh8=",
"owner": "rycee", "owner": "rycee",
"repo": "nur-expressions", "repo": "nur-expressions",
"rev": "3ce9dae224e8750e0d05b7dd3101fea61004e475", "rev": "8b3184e20f30a14cc966d11a1409f0143cf4e9f3",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@ -40,11 +40,11 @@
}, },
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1718894893, "lastModified": 1719552654,
"narHash": "sha256-hxQBUtDbFOCCW1CsFZTS9Q5Ov1ZKdJgbBZHSez1M6iA=", "narHash": "sha256-PX3msbC5KdwCDnucGtir3qzlzv+1fuiU4tk17nljFIE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "083823b7904e43a4fc1c7229781417e875359a42", "rev": "3980e7816c99d9e4da7a7b762e5b294055b73b2f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -60,11 +60,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1718788307, "lastModified": 1719584202,
"narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", "narHash": "sha256-lL0j2vltAX4L5z6APsQVCpNrfzI15P0O/tZ5PMgUCXE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", "rev": "f50e2779edbc905ab131ce7ce36b14a09ab44f3c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -75,11 +75,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1718714799, "lastModified": 1719254875,
"narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -91,11 +91,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1718811006, "lastModified": 1719234068,
"narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=", "narHash": "sha256-1AjSIedDC/aERt24KsCUftLpVppW61S7awfjGe7bMio=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "03d771e513ce90147b65fe922d87d3a0356fc125", "rev": "90bd1b26e23760742fdcb6152369919098f05417",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -36,13 +36,6 @@
set -q fish_color_status set -q fish_color_status
or set -g fish_color_status red or set -g fish_color_status red
# Detect if we're in a nix-shell
set -l nix_shell_info (
if test -n "$IN_NIX_SHELL"
echo -n "[nix-shell] "
end
)
# Color the prompt differently when we're root # Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd set -l color_cwd $fish_color_cwd
set -l suffix '>' set -l suffix '>'
@ -65,7 +58,47 @@
set -l statusb_color (set_color $bold_flag $fish_color_status) set -l statusb_color (set_color $bold_flag $fish_color_status)
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$nix_shell_info $prompt_status $suffix " " echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal " "$nix_shell_info $prompt_status $suffix " "
'';
fish_right_prompt = ''
set -l normal (set_color normal)
# vcs
set -g __fish_git_prompt_showdirtystate 1
set -g __fish_git_prompt_showuntrackedfiles 1
set -g __fish_git_prompt_showstashstate 1
set -g __fish_git_prompt_showupstream informative
set -g __fish_git_prompt_showcolorhints 1
set -g __fish_git_prompt_use_informative_chars 1
string match -qi "*.utf-8" -- $LANG $LC_CTYPE $LC_ALL
and set -g __fish_git_prompt_char_dirtystate \U1F4a9
set -g __fish_git_prompt_char_untrackedfiles "?"
set -l vcs (fish_vcs_prompt '(%s)' 2>/dev/null)
# timestamp
set -l d (set_color brgrey)(date "+%R")$normal
# execution duration
set -l duration "$cmd_duration$CMD_DURATION"
if test $duration -gt 100
set duration (math $duration / 1000)s
else
set duration
end
# virtual env
set -q VIRTUAL_ENV_DISABLE_PROMPT
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
set -q VIRTUAL_ENV
and set -l venv (string replace -r '.*/' "" -- "$VIRTUAL_ENV")
# nix-shell
set -l nix (
if test -n "$IN_NIX_SHELL"
echo -n "[nix]"
end
)
string join " " -- $duration $venv $nix $vcs $d
''; '';
get-local-ip = "ip addr show $(ip route | grep default | awk '{print $5}') | grep 'inet ' | awk '{print $2}' | cut -d/ -f1"; get-local-ip = "ip addr show $(ip route | grep default | awk '{print $5}') | grep 'inet ' | awk '{print $2}' | cut -d/ -f1";