aboutsummaryrefslogtreecommitdiff
path: root/functions/keys.fish
blob: 487e3842e97472e05a574e9966a596c1afd6a02a (plain)
1
2
3
4
5
6
7
8
9
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
function keys --description 'Show keyboard shortcuts list' -a program

function _print_shortcut -a shcut -a desc
  set_color green
  printf "%-12s" $shcut
  set_color normal
  printf " →    %s\n" $desc
end

if test -z "$program"
  set program 'fish'
end

echo
echo \# $program
echo
printf "%-12s      %s\n" 'Shortcut' 'Description'
echo
switch $program
  case 'fish'
    _print_shortcut 'CTRL+x' 'quit fish'
    _print_shortcut 'CTRL+l' 'clear screen'
    _print_shortcut 'ALT+left' 'go to the previous directory'
    _print_shortcut 'ALT+right' 'go to the next directory'
    _print_shortcut 'ALT+r' 'repeat last command'
    _print_shortcut 'ALT+s' 'prepend super user command'
  case '*'
    echo 'Unknown program.'
end
echo

functions -e _print_shortcut

end