From e1c7d5b4281aac3fdcc9f3a1799f0d6d501977c2 Mon Sep 17 00:00:00 2001 From: Brad Clawsie Date: Wed, 6 Jul 2022 19:52:19 -0500 Subject: refactor --- fish/config.fish | 36 ++++++++++++++++++++++++++++++++++++ fish/functions/fish_prompt.fish | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 fish/config.fish create mode 100644 fish/functions/fish_prompt.fish (limited to 'fish') diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..2f61a01 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,36 @@ +# perl +set -gx PERL_UNICODE AS +set -gx PERL_READLINE_NOWARN yes +set -gx GROKLOC_REPO $HOME/repos/grokloc-perl5 +set -gx GROKLOC_LIB_INC $GROKLOC_REPO/lib +set -gx GROKLOC_SERVICE_INC $GROKLOC_REPO/service/app/lib +set -gx GROKLOC_INCS $GROKLOC_LIB_INC:$GROKLOC_SERVICE_INC +set -gx PERL5LIB $GROKLOC_INCS:$HOME/perl5/lib/perl5 + +# paths +set -gx PATH $HOME/bin:$HOME/perl5/bin:$HOME/go/bin:$HOME/.cargo/bin:$PATH + +alias c clear +alias h history + +if status is-interactive + # locale + set -gx LANG en_US.UTF-8 + set -gx LC_ALL en_US.UTF-8 + + # history + set -gx HISTFILE $HOME/.histfile + set -gx HISTSIZE 10000 + set -gx SAVEHIST 10000 + + # default editor + set -gx EDITOR emacsclient + set -gx ALTERNATE_EDITOR emacs + set -gx VISUAL emacsclient + + # gnupg + set -gx GPG_TTY $(tty) + gpg-connect-agent updatestartuptty /bye >/dev/null + + clear; +end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..506e245 --- /dev/null +++ b/fish/functions/fish_prompt.fish @@ -0,0 +1,34 @@ +# name: Astronaut +# author: Radu Potop +# description: A prompt theme similar to Starship.rs but without the emojis. + +function fish_prompt --description 'Write out the prompt' + set -l last_status $status + set -l normal (set_color normal) + set -l status_color (set_color brgreen) + set -l cwd_color (set_color $fish_color_cwd) + set -l vcs_color (set_color brpurple) + set -l prompt_status "" + + # Since we display the prompt on a new line allow the directory names to be longer. + set -q fish_prompt_pwd_dir_length + or set -lx fish_prompt_pwd_dir_length 0 + + # Color the prompt differently when we're root + set -l suffix '>' + if functions -q fish_is_root_user; and fish_is_root_user + if set -q fish_color_cwd_root + set cwd_color (set_color $fish_color_cwd_root) + end + set suffix '#' + end + + # Color the prompt in red on error + if test $last_status -ne 0 + set status_color (set_color $fish_color_error) + set prompt_status $status_color "[" $last_status "]" $normal + end + + echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status + echo -n -s $status_color $suffix ' ' $normal +end -- cgit v1.2.3