aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/abbr.txt
blob: 799e5003297454368bc38bbab7054dcb0b1ea7ec (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\section abbr abbr - manage fish abbreviations

\subsection abbr-synopsis Synopsis
\fish{synopsis}
abbr -a word="phrase"
abbr -s
abbr -l
abbr -e word
\endfish

\subsection abbr-description Description

`abbr` manipulates the list of abbreviations that fish will expand.

Abbreviations are user-defined character sequences or words that are replaced with longer phrases after they are entered. For example, a frequently-run command such as `git checkout` can be abbreviated to `gco`. After entering `gco` and pressing @key{Space} or @key{Enter}, the full text `git checkout` will appear in the command line.

Abbreviations are stored using universal variables. You can create abbreviations directly on the command line, and they will be saved automatically. Do not place them in config.fish, because this will lead to worse startup performance. Alternatively, guard the assignment with another universal variable, like:

\fish
if not set -q my_fish_abbreviations
    abbr gco='git checkout'
    abbr abr='another abbreviation expansion'
    set -U my_fish_abbreviations 1
end
\endfish

The following parameters are available:

- `-a WORD PHRASE` or `--add WORD PHRASE` Adds a new abbreviation, where WORD will be expanded to PHRASE.

- `-s` or `--show` Show all abbreviated words and their expanded phrases in a manner suitable for export and import.

- `-l` or `--list` Lists all abbreviated words.

- `-e WORD` or `--erase WORD` Erase the abbreviation WORD.

\subsection abbr-example Examples

\fish
abbr -a gco git checkout
\endfish
Add a new abbreviation where `gco` will be replaced with `git checkout`.

\fish
abbr -e gco
\endfish
Erase the `gco` abbreviation.

\fish
ssh another_host abbr -s | source
\endfish
Import the abbreviations defined on another_host over SSH.