5 prism_languages: [fish]
12 | Shortcut | Description |
14 | `^A ←` _/_ `^E →` | Move to line beginning/end |
15 | `Alt ←` _/_ `Alt →` | Move word |
16 | `^U` | Delete to beginning |
17 | `^W` | Delete to previous `/` |
18 | `^D` | Delete next character |
19 | `Alt D` | Delete next word |
20 | `^C` | Cancel line |
21 | `Alt P` | Page output |
23 | `Alt ↑` _/_ `Alt ↓` | Previous _/_ next arguments |
24 | `Alt E` _/_ `Alt V` | Open in external editor |
25 | `^L` | Repaint screen |
30 | `Alt H` | Help on word (man) |
31 | `Alt W` | Help on word (short descriptions) |
32 | `Alt L` | List directory on cursor |
37 ### Defining and erasing
40 set my_variable "Hello from Fish!"
44 set --erase my_variable
47 ### Incrementing and decrementing
50 set my_variable (math $my_variable + 1)
51 set my_variable (math $my_variable - 1)
57 set my_variable $another_variable[1..10]
58 set my_variable $another_variable[2..]
59 set my_variable $another_variable[..-2]
68 | Operator | Performs |
72 | `*` | Multiplication |
75 | `^` | Exponentiation |
78 ## String manipulation
81 string match --regex --entire 'Fish' 'Hello from Fish!'
85 string replace --regex 'Fish' 'fish' 'Hello from Fish!'
90 | `x?` | Zero or one `x` chars |
91 | `x*` | Any count `x` chars |
92 | `x+` | One or more `x` chars |
93 | `x{n}` | n times `x` chars |
94 | `x{n,m}` | n to m times `x` chars |
95 | `x{n,}` | n or more times `x` chars |
96 | `x{n,}` | n or more times `x` chars |
97 | `[xy] ` | `x` or y char |
98 | `[^xy]` | not `x` or y char |
101 | Class | Description |
103 | `\w` | Word character |
104 | `\d` | Digit character |
105 | `\W` | Not word character |
106 | `\D` | Not digit character |
112 if test $my_variable -lt $another_variable
114 else if test $my_variable -eq $another_variable
121 | Operator | Meaning |
123 | `-lt` | [L]ess [t]han |
125 | `-gt` | [G]reater [t]han |
126 | `-le` | [L]ess than or [e]qual to |
127 | `-ge` | [G]reater than or [e]qual to |
128 | `-f` | [F]ile exists |
129 | `-d` | [D]irectory exists |
130 | `-r` | File or directory exists and [r]eadable |
131 | `-w` | File or directory exists and [w]ritable |
132 | `-x` | File or directory exists and e[x]ecutable |
143 ## Command substitution
146 set my_variable (math $my_variable + 1)
151 ### Defining and erasing
154 function my_function --description "My description"
160 functions --erase my_function
166 function my_hook --on-event my_event
182 ### Defining and erasing
185 abbr --add my_abbreviation echo "Hello from Fish!"
189 abbr --erase my_abbreviation
194 ### Defining and erasing
197 complete --command mycommand --arguments 'install uninstall'
198 complete --command mycommand --short-option 'h' --long-option 'help' --description 'Display help'
202 complete --command mycommand --erase
205 | Option | Description |
207 | `--arguments` | Arguments to command itself or option |
208 | `--short-option` | Short option |
209 | `--long-option` | Long option |
210 | `--no-files` | Don't suggest files |
211 | `--force-files` | Suggest files |
212 | `--condition` | Display hint only when condition is true |
213 | `--description` | Description |
216 ## Useful built-in functions
218 | Condition | Description
220 | `-n __fish_complete_directories STRING DESCRIPTION` | performs path completion on STRING, allowing only directories, and giving them the description DESCRIPTION.
221 | `-n __fish_complete_path STRING DESCRIPTION` | performs path completion on STRING, giving them the description DESCRIPTION.
222 | `-n __fish_complete_groups` | prints a list of all user groups with the groups members as description.
223 | `-n __fish_complete_pids` | prints a list of all processes IDs with the command name as description.
224 | `-n __fish_complete_suffix SUFFIX` | performs file completion allowing only files ending in SUFFIX. The mimetype database is used to find a suitable description.
225 | `-n __fish_complete_users` | prints a list of all users with their full name as description.
226 | `-n __fish_print_filesystems` | prints a list of all known file systems. Currently, this is a static list, and not dependent on what file systems the host operating system actually understands.
227 | `-n __fish_print_hostnames` | prints a list of all known hostnames. This functions searches the fstab for nfs servers, ssh for known hosts and checks the /etc/hosts file.
228 | `-n __fish_print_interfaces` | prints a list of all known network interfaces.
229 | `-n __fish_print_packages` | prints a list of all installed packages. This function currently handles Debian, rpm and Gentoo packages.
230 | `-n __fish_use_subcommand` |
231 | `-n __fish_seen_subcommand_from init` |