NameSizeMode
..
.config/fish/config.fish 2K ?rw-r--r--
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#                   __ _          __ _     _     
#                  / _(_)        / _(_)   | |    
#   ___ ___  _ __ | |_ _  __ _  | |_ _ ___| |__  
#  / __/ _ \| '_ \|  _| |/ _` | |  _| / __| '_ \ 
# | (_| (_) | | | | | | | (_| |_| | | \__ \ | | |
#  \___\___/|_| |_|_| |_|\__, (_)_| |_|___/_| |_|
#                         __/ |                  
#                        |___/                   
# 
# 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'

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

function fish_greeting
  computer_ascii_art
  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