dotfiles

My personal dotfiles 💠️

config.fish (1989B)

      1 #                   __ _          __ _     _     
      2 #                  / _(_)        / _(_)   | |    
      3 #   ___ ___  _ __ | |_ _  __ _  | |_ _ ___| |__  
      4 #  / __/ _ \| '_ \|  _| |/ _` | |  _| / __| '_ \ 
      5 # | (_| (_) | | | | | | | (_| |_| | | \__ \ | | |
      6 #  \___\___/|_| |_|_| |_|\__, (_)_| |_|___/_| |_|
      7 #                         __/ |                  
      8 #                        |___/                   
      9 # 
     10 # Pablo (C) 2021
     11 
     12 # Sources environment variables
     13 source "$HOME/.local/bin/exports.sh"
     14 
     15 # Load OCaml stuff
     16 eval (opam env)
     17 
     18 # Configure the PATH variable
     19 set PATH $PATH /usr/local/share/*/{include,bin,lib}
     20 
     21 # Abbreviations
     22 abbr vim     'nvim'
     23 abbr sc      'sc-im'
     24 abbr weather 'curl https://wttr.in/'
     25 abbr mutt    'neomutt'
     26 abbr matrix  'cmatrix'
     27 
     28 # Aliases
     29 source "$HOME/.local/bin/aliases.sh"
     30 
     31 function fish_greeting
     32     set_color yellow
     33     fortune | cowthink -f none
     34     set_color normal
     35     fish_logo red ff743d yellow
     36     printf '\n'
     37 end
     38 
     39 function _fish_prompt_long
     40   # Formatted pwd
     41   set dir (string replace "$HOME" '~' (pwd))
     42 
     43   set_color normal
     44   set_color white
     45   printf "["
     46 
     47   # Print the username
     48   set_color --bold green
     49   printf "%s@%s" (whoami) (hostname)
     50 
     51   # Print the current directory
     52   set_color --bold blue
     53   printf " %s" "$dir"
     54 
     55   # Print the current git branch (if inside a repo)
     56   set_color --bold cyan
     57   __fish_git_prompt
     58 
     59   set_color normal
     60   set_color white
     61   printf ']' 
     62 end
     63 
     64 function _fish_prompt_medium
     65   # Formatted pwd
     66   set dir (string replace "$HOME" '~' (pwd))
     67 
     68   set_color --bold blue
     69   printf '%s ' "$dir"
     70   set_color normal
     71   set_color white
     72 end
     73 
     74 function fish_prompt
     75   # Show fancy prompt if the screen is big enought
     76   if test (string length (_fish_prompt_long)) -lt (tput cols)
     77     _fish_prompt_long
     78   else if test (string length (_fish_prompt_medium)) -lt (tput cols)
     79     _fish_prompt_medium
     80   end
     81 
     82   if test $status -ne 0
     83     set_color red
     84   end
     85 
     86   if test "$USER" = root
     87     printf '# '
     88   else
     89     printf '$ '
     90   end
     91 
     92   set_color normal
     93 end
     94