NameSizeMode
..
.config/fish/config.fish 2K ?rw-r--r--
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
#                   __ _          __ _     _     
#                  / _(_)        / _(_)   | |    
#   ___ ___  _ __ | |_ _  __ _  | |_ _ ___| |__  
#  / __/ _ \| '_ \|  _| |/ _` | |  _| / __| '_ \ 
# | (_| (_) | | | | | | | (_| |_| | | \__ \ | | |
#  \___\___/|_| |_|_| |_|\__, (_)_| |_|___/_| |_|
#                         __/ |                  
#                        |___/                   
# 
# Pablo (C) 2025

# sources environment variables
source "$HOME/.local/bin/exports.sh"

if type -q opam
  eval (opam env)
end

# configure the PATH variable
set PATH $PATH /usr/local/share/*/{include,bin,lib}

# abbreviations
abbr vim         'nvim'
abbr sc          'sc-im'
abbr weather     'curl https://wttr.in/'
abbr mutt        'neomutt'
abbr matrix      'cmatrix'
abbr remote      'transmission-remote'
abbr backlight   'xbacklight'
abbr light       'xbacklight'
abbr htop        'btop'
abbr jupiter-lab 'jupyter-lab'

# aliases
source "$HOME/.local/bin/aliases.sh"

function fish_greeting
    set_color yellow
    fortune | cowthink -f none
    set_color normal
    fish_logo red ff743d yellow
    printf '\n'
end

function _fish_prompt_long
  set dir (string replace "$HOME" '~' (pwd))

  set_color normal
  set_color white
  printf "["

  # print the username
  set_color --bold green
  printf "%s@%s" (whoami) (hostname)

  # print the current directory
  set_color --bold blue
  printf " %s" "$dir"

  # print the current git branch (if inside a repo)
  set_color --bold cyan
  __fish_git_prompt

  set_color normal
  set_color white
  printf ']' 
end

function _fish_prompt_medium
  set dir (string replace "$HOME" '~' (pwd))

  set_color --bold blue
  printf '%s ' "$dir"
  set_color normal
  set_color white
end

function fish_prompt
  set saved_status $status

  # show fancy prompt if the screen is big enought
  if test (string length (_fish_prompt_long)) -lt (tput cols)
    _fish_prompt_long
  else if test (string length (_fish_prompt_medium)) -lt (tput cols)
    _fish_prompt_medium
  end

  if test $saved_status -ne 0
    set_color red
  end

  if test "$USER" = root
    printf '# '
  else
    printf '$ '
  end

  set_color normal
end