diff --git a/.bashrc b/.bashrc index 5431a5f..f805e5e 100644 --- a/.bashrc +++ b/.bashrc @@ -4,8 +4,8 @@ # If not running interactively, don't do anything case $- in - *i*) ;; - *) return;; +*i*) ;; +*) return ;; esac # don't put duplicate lines or lines starting with space in the history. @@ -37,7 +37,7 @@ fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; +xterm-color | *-256color) color_prompt=yes ;; esac # uncomment for a colored prompt, if the terminal has the capability; turned @@ -47,12 +47,12 @@ esac if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes else - color_prompt= + color_prompt= fi fi @@ -65,11 +65,11 @@ unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in -xterm*|rxvt*) +xterm* | rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; -*) - ;; +*) ;; + esac # enable color support of ls and also add handy aliases @@ -109,20 +109,11 @@ fi # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi - -# Powerline Shell -function _update_ps1() { - PS1=$(powerline-shell $?) -} - -if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then - PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi fi # Run neofetch when opening terminal @@ -134,3 +125,6 @@ alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' # EXPORTS export EDITOR="code -w" export TERM=xterm-256color + +# Starship Prompt +eval "$(starship init bash)" diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 8e0d005..8a2143b 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -47,73 +47,5 @@ alias config="GIT_WORK_TREE=~ GIT_DIR=~/.cfg" ############### # FISH PROMPT # ############### -# This was the 'sashimi' prompt from oh-my-fish. -function fish_prompt - set -l last_status $status - set -l cyan (set_color -o $fish_color_command) - set -l yellow (set_color -o $fish_color_quote) - set -g red (set_color -o $fish_color_error) - set -g purple (set_color -o $fish_color_param) - set -l green (set_color -o $fish_color_operator) - set -g normal (set_color -o $fish_color_escape) - - set -l ahead (_git_ahead) - set -g whitespace ' ' - - if test $last_status = 0 - set initial_indicator "$green◆" - set status_indicator "$normal❯$cyan❯$green❯" - else - set initial_indicator "$red✖ $last_status" - set status_indicator "$red❯$red❯$red❯" - end - set -l cwd $cyan(prompt_pwd) - - if [ (_git_branch_name) ] - if test (_git_branch_name) = 'master' || test (_git_branch_name) = 'main' - set -l git_branch (_git_branch_name) - set git_info "$normal git:($red$git_branch$normal)" - else - set -l git_branch (_git_branch_name) - set git_info "$normal git:($purple$git_branch$normal)" - end - if [ (_is_git_dirty) ] - set -l dirty "$yellow ✗" - set git_info "$git_info$dirty" - end - end - # Notify if a command took more than 5 minutes - if [ "$CMD_DURATION" -gt 300000 ] - echo The last command took (math "$CMD_DURATION/1000") seconds. - end - - echo -n -s $initial_indicator $whitespace $cwd $git_info $whitespace $ahead $status_indicator $whitespace -end - -function _git_ahead - set -l commits (command git rev-list --left-right '@{upstream}...HEAD' ^/dev/null) - if [ $status != 0 ] - return - end - set -l behind (count (for arg in $commits; echo $arg; end | grep '^<')) - set -l ahead (count (for arg in $commits; echo $arg; end | grep -v '^<')) - switch "$ahead $behind" - case '' # no upstream - case '0 0' # equal to upstream - return - case '* 0' # ahead of upstream - echo "$purple↑$normal_c$ahead$whitespace" - case '0 *' # behind upstream - echo "$red↓$normal_c$behind$whitespace" - case '*' # diverged from upstream - echo "$purple↑$normal$ahead $red↓$normal_c$behind$whitespace" - end -end - -function _git_branch_name - echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') -end - -function _is_git_dirty - echo (command git status -s --ignore-submodules=dirty ^/dev/null) -end +# Starship Prompt +starship init fish | source diff --git a/.config/starship.toml b/.config/starship.toml new file mode 100644 index 0000000..c2df5aa --- /dev/null +++ b/.config/starship.toml @@ -0,0 +1,98 @@ +# ~/.config/starship.toml + +# Don't print a new line at the start of the prompt +add_newline = false + +format = "[◆](bold green) $all" + +[aws] +symbol = " " + +[battery] +full_symbol = "" +charging_symbol = "" +discharging_symbol = "" + +[character] +format = "$symbol" +success_symbol = "[❯](bold purple)[❯](bold cyan)[❯](bold green) " +error_symbol = "[❯❯❯](bold red) " + +[cmd_duration] +min_time = 10_000 + +[conda] +symbol = " " + +[dart] +symbol = " " + +[directory] +format = "[$path]($style)[$read_only]($read_only_style) " +truncation_length = 4 +truncate_to_repo = false +truncation_symbol = "…/" +read_only = "" + +[docker] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[git_branch] +symbol = " " + +[golang] +symbol = " " + +[haskell] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[line_break] +disabled = true + +[memory_usage] +symbol = " " + +[nim] +symbol = " " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[package] +symbol = " " + +[perl] +symbol = " " + +[php] +symbol = " " + +[python] +symbol = " " + +[ruby] +symbol = " " + +[rust] +symbol = " " + +[swift] +symbol = "ﯣ "