diff --git a/modules/shell.nix b/modules/shell.nix index c9782b6..362ef1f 100644 --- a/modules/shell.nix +++ b/modules/shell.nix @@ -29,8 +29,6 @@ ffmpeg imagemagick - ] ++ lib.optionals config.programs.fish.enable [ - pkgs.fishPlugins.pure ] ++ lib.optionals pkgs.stdenv.isLinux [ pkgs.trash-cli ]; programs.tmux.enable = true; diff --git a/stow/.config/fish/.gitignore b/stow/.config/fish/.gitignore index e4d0790..23efee9 100644 --- a/stow/.config/fish/.gitignore +++ b/stow/.config/fish/.gitignore @@ -1,2 +1 @@ fish_variables -pure_prompt_colours diff --git a/stow/.config/fish/config.fish b/stow/.config/fish/config.fish index e18731f..9622f7c 100644 --- a/stow/.config/fish/config.fish +++ b/stow/.config/fish/config.fish @@ -1,31 +1,75 @@ if status is-interactive # Commands to run in interactive sessions can go here + + # + # shell prompt + # + # match prompt symbol to OS logo - if test -e /System - set pure_symbol_prompt "" - eval "$(/opt/homebrew/bin/brew shellenv)" - else + if test -e /etc/os-release posix-source /etc/os-release - if [ "$ID" = "nixos" ] - set pure_symbol_prompt "" - else if [ "$ID" = "debian" ] - set pure_symbol_prompt "" - else if [ "$ID" = "fedora" ] - set pure_symbol_prompt "" - else if [ "$ID" = "arch" ] - set pure_symbol_prompt "󰣇" - end end - cat ~/.config/fish/pure_colours.fish | source + if test -e /System + set os_icon "" + eval "$(/opt/homebrew/bin/brew shellenv)" + else if [ "$ID" = "nixos" ] + set os_icon "" + else if [ "$ID" = "debian" ] + set os_icon "" + else if [ "$ID" = "fedora" ] + set os_icon "" + else if [ "$ID" = "arch" ] + set os_icon "󰣇" + else + set os_icon "\$" + end + + # set prompt colours + if test -e ~/.cache/zsh_colours.sh + posix-source (string replace -fra "{|}|#|\"" "" (cat ~/.cache/zsh_colours.sh) | psub) + else + set PRIMARY_COLOUR blue + set SECONDARY_COLOUR purple + end + + + # construct final prompt + function fish_prompt + # turn os_icon red if an error occurs + set -l prompt_icon + if test $status -ne 0 + set prompt_icon (set_color red)"$os_icon"(set_color normal) + else + set prompt_icon "$os_icon" + end + + # set ssh status + set -l ssh_status + if set -q SSH_CONNECTION + set ssh_status (prompt_login) + end + + # concatenate $HOME to a ~ eg. /home/user to ~ + set shorten_path (string replace -r "^$HOME" "~" "$PWD") + + echo (set_color $PRIMARY_COLOUR)$shorten_path $ssh_status (set_color $SECONDARY_COLOUR)$prompt_icon (set_color normal) + end + + # + # shell intergration + # - set pure_enable_single_line_prompt true - set HOMEBREW_AUTO_UPDATE_SECS 86400 zoxide init fish | source + # # environment variables + # + set -gx EDITOR nvim + set fish_greeting "" + set HOMEBREW_AUTO_UPDATE_SECS 86400 # xdg variables set -gx XDG_CONFIG_HOME "$HOME/.config" # config diff --git a/stow/.config/matugen/config.toml b/stow/.config/matugen/config.toml index 56b195d..03c5790 100644 --- a/stow/.config/matugen/config.toml +++ b/stow/.config/matugen/config.toml @@ -64,11 +64,6 @@ post_hook = 'sh ~/.cache/matugen-jankyborders.sh & disown' input_path = './templates/zsh.sh' output_path = '~/.cache/zsh_colours.sh' -[templates.fish-pure] -input_path = './templates/pure.fish' -output_path = '~/.config/fish/pure_colours.fish' -post_hook = 'fish ~/.config/fish/pure_colours.fish' - [templates.fuzzel] input_path = './templates/fuzzel.ini' output_path = '~/.config/fuzzel/colors.ini' diff --git a/stow/.config/matugen/templates/pure.fish b/stow/.config/matugen/templates/pure.fish deleted file mode 100644 index fc74d4b..0000000 --- a/stow/.config/matugen/templates/pure.fish +++ /dev/null @@ -1,15 +0,0 @@ -set pure_color_primary {{colors.primary.default.hex_stripped}} -set pure_color_normal {{colors.on_primary.default.hex_stripped}} -set pure_color_success {{colors.on_primary_container.default.hex_stripped}} -set pure_color_warning {{colors.secondary_fixed_dim.default.hex_stripped}} - -set pure_color_info {{colors.secondary.default.hex_stripped}} -set pure_color_danger {{colors.error.default.hex_stripped}} -set pure_color_mute {{colors.surface_bright.default.hex_stripped}} - -set pure_color_light {{colors.secondary.default.hex_stripped}} -set pure_color_dark {{colors.secondary.default.hex_stripped}} - -set pure_color_git_unpushed_commits {{colors.tertiary.default.hex_stripped}} -set pure_color_git_dirty {{colors.tertiary.default.hex_stripped}} -set pure_color_git_stash {{colors.tertiary.default.hex_stripped}}