aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
Diffstat (limited to 'functions')
-rw-r--r--functions/keys.fish34
1 files changed, 34 insertions, 0 deletions
diff --git a/functions/keys.fish b/functions/keys.fish
new file mode 100644
index 0000000..487e384
--- /dev/null
+++ b/functions/keys.fish
@@ -0,0 +1,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