mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Consistency fixes
This commit is contained in:
parent
137abd0cfa
commit
98ebb21489
20
Doxyfile
20
Doxyfile
|
@ -216,7 +216,7 @@ SEPARATE_MEMBER_PAGES = NO
|
|||
# uses this value to replace tabs by spaces in code fragments.
|
||||
# Minimum value: 1, maximum value: 16, default value: 4.
|
||||
|
||||
TAB_SIZE = 8
|
||||
TAB_SIZE = 4
|
||||
|
||||
# This tag can be used to specify a number of aliases that act as commands in
|
||||
# the documentation. An alias has the form:
|
||||
|
@ -228,14 +228,16 @@ TAB_SIZE = 8
|
|||
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||
# newlines.
|
||||
|
||||
# Simplify Fish output from Doxygen for developer doc pages. (see lexicon_filter.in)
|
||||
|
||||
ALIASES = "key{1}=<b>\1</b>"
|
||||
ALIASES += "key{2}=<b>\1</b>-<b>\2</b>"
|
||||
ALIASES += "key{3}=<b>\1</b>-<b>\3</b>"
|
||||
ALIASES += "key{2}=<b>\1-\2</b>"
|
||||
ALIASES += "key{3}=<b>\1-\3</b>"
|
||||
ALIASES += "cursor_key{2}=<b>\2</b>"
|
||||
|
||||
ALIASES += "fish=\htmlonly[block] \n<pre>"
|
||||
ALIASES += "fish{1}=\htmlonly[block] \n<pre>"
|
||||
ALIASES += "endfish=</pre>\endhtmlonly \n"
|
||||
ALIASES += "fish=<pre>"
|
||||
ALIASES += "fish{1}=<pre>"
|
||||
ALIASES += "endfish=</pre>\n"
|
||||
|
||||
ALIASES += "asis{1}=\1"
|
||||
ALIASES += "outp{1}=\1"
|
||||
|
@ -271,6 +273,8 @@ ALIASES += "undr{1}=\1"
|
|||
ALIASES += "span{2}=\2"
|
||||
ALIASES += "spcl{2}=\2"
|
||||
|
||||
ALIASES += "bksl{1}=\\\1"
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
@ -1677,7 +1681,7 @@ PAPER_TYPE = a4wide
|
|||
# If left blank no extra packages will be included.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
EXTRA_PACKAGES =
|
||||
EXTRA_PACKAGES = bookmark
|
||||
|
||||
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
|
||||
# generated LaTeX document. The header should contain everything until the first
|
||||
|
@ -1736,7 +1740,7 @@ USE_PDFLATEX = YES
|
|||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_BATCHMODE = YES
|
||||
|
||||
# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
|
||||
# index chapters (such as File Index, Compound Index, etc.) in the output.
|
||||
|
|
|
@ -228,12 +228,12 @@ TAB_SIZE = 4
|
|||
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||
# newlines.
|
||||
|
||||
# Simplify Fish output from Doxygen for man pages. (see fish_lexicon_filter)
|
||||
# Simplify Fish output from Doxygen for man pages. (see lexicon_filter.in)
|
||||
|
||||
ALIASES = "key{1}=<b>\1</b>"
|
||||
ALIASES += "key{2}=<b>\1</b>-<em>\2</em>"
|
||||
ALIASES += "key{3}=<b>\1</b>-<em>\3</em>"
|
||||
ALIASES += "cursor_key{2}=<b>\2</b>"
|
||||
ALIASES = "key{1}=[<b>\1</b>]"
|
||||
ALIASES += "key{2}=[<b>\1</b>-<em>\2</em>]"
|
||||
ALIASES += "key{3}=[<b>\1</b>-<em>\3</em>]"
|
||||
ALIASES += "cursor_key{2}=[<b>\2</b>]"
|
||||
|
||||
ALIASES += "fish=<pre>"
|
||||
ALIASES += "fish{1}=<pre>"
|
||||
|
@ -273,6 +273,8 @@ ALIASES += "undr{1}=<em>\1</em>"
|
|||
ALIASES += "span{2}=\2"
|
||||
ALIASES += "spcl{2}=\2"
|
||||
|
||||
ALIASES += "bksl{1}=\\\1"
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
|
|
@ -228,7 +228,7 @@ TAB_SIZE = 4
|
|||
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||
# newlines.
|
||||
|
||||
# Enhance Fish docs output from Doxygen. (See fish_lexicon_filter.in)
|
||||
# Enhance Fish docs output from Doxygen. (See lexicon_filter.in)
|
||||
|
||||
ALIASES = "key{1}=<span class=\"key\"><b>\1</b></span>"
|
||||
ALIASES += "key{2}=<span class=\"key\"><em>\1</em><span>-</span><b>\2</b></span>"
|
||||
|
@ -273,6 +273,8 @@ ALIASES += "undr{1}=<span class=\"underline\">\1</span>"
|
|||
ALIASES += "span{2}=<span style=\"\1\">\2</span>"
|
||||
ALIASES += "spcl{2}=<span class=\"\1\">\2</span>"
|
||||
|
||||
ALIASES += "bksl{1}=<span>\</span>\1"
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
|
11
Makefile.in
11
Makefile.in
|
@ -285,10 +285,10 @@ doc: *.h *.cpp doc.h Doxyfile lexicon_filter
|
|||
#
|
||||
|
||||
doc/refman.pdf: doc
|
||||
cd doc/latex;
|
||||
make;
|
||||
mv refman.pdf ..;
|
||||
cd ../..;
|
||||
cd doc/latex; \
|
||||
make; \
|
||||
mv refman.pdf ..; \
|
||||
cd ../..; \
|
||||
rm -r doc/latex;
|
||||
|
||||
|
||||
|
@ -368,7 +368,8 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES
|
|||
-e "s|'\(.*\)'|func \1|p"; \
|
||||
sed <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
|
||||
-e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \
|
||||
echo "sbin whoami\nsbin mkdir\nsbin basename" >> lexicon.tmp; \
|
||||
sed <lexicon_filter.in >>lexicon.tmp -n \
|
||||
-e '/^#!#/s/^#!# \(.... [a-z][a-z_]*\)/\1/p'; \
|
||||
mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt;
|
||||
|
||||
#
|
||||
|
|
|
@ -89,7 +89,13 @@ The following special input functions are available:
|
|||
|
||||
\subsection bind-example Examples
|
||||
|
||||
`bind \cd 'exit'` causes `fish` to exit when @key{Control,D} is pressed.
|
||||
\fish
|
||||
bind \cd 'exit'
|
||||
\endfish
|
||||
Causes `fish` to exit when @key{Control,D} is pressed.
|
||||
|
||||
`bind -k ppage history-search-backward` performs a history search when the @key{Page Up} key is pressed.
|
||||
\fish
|
||||
bind -k ppage history-search-backward
|
||||
\endfish
|
||||
Performs a history search when the @key{Page Up} key is pressed.
|
||||
|
||||
|
|
|
@ -50,21 +50,29 @@ When erasing completions, it is possible to either erase all completions for a s
|
|||
|
||||
The short style option `-o` for the `gcc` command requires that a file follows it. This can be done using writing:
|
||||
|
||||
`complete -c gcc -s o -r`
|
||||
\fish
|
||||
complete -c gcc -s o -r
|
||||
\endfish
|
||||
|
||||
The short style option `-d` for the `grep` command requires that one of the strings '`read`', '`skip`' or '`recurse`' is used. This can be specified writing:
|
||||
|
||||
`complete -c grep -s d -x -a "read skip recurse"`
|
||||
\fish
|
||||
complete -c grep -s d -x -a "read skip recurse"
|
||||
\endfish
|
||||
|
||||
The `su` command takes any username as an argument. Usernames are given as the first colon-separated field in the file /etc/passwd. This can be specified as:
|
||||
|
||||
`complete -x -c su -d "Username" -a "(cat /etc/passwd | cut -d : -f 1)"`
|
||||
\fish
|
||||
complete -x -c su -d "Username" -a "(cat /etc/passwd | cut -d : -f 1)"
|
||||
\endfish
|
||||
|
||||
The `rpm` command has several different modes. If the `-e` or `--erase` flag has been specified, `rpm` should delete one or more packages, in which case several switches related to deleting packages are valid, like the `nodeps` switch.
|
||||
|
||||
This can be written as:
|
||||
|
||||
`complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d "Don't check dependencies"`
|
||||
\fish
|
||||
complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d "Don't check dependencies"
|
||||
\endfish
|
||||
|
||||
where `__fish_contains_opt` is a function that checks the commandline buffer for the presence of a specified set of options.
|
||||
|
||||
|
|
|
@ -18,10 +18,8 @@ count $VARIABLE
|
|||
|
||||
\fish
|
||||
count $PATH
|
||||
|
||||
# Returns the number of directories in the users PATH variable.
|
||||
|
||||
count *.txt
|
||||
|
||||
# Returns the number of files in the current working directory ending with the suffix '.txt'.
|
||||
\endfish
|
|
@ -7,37 +7,21 @@
|
|||
\endhtmlonly
|
||||
|
||||
- <a href='#faq-envvar'>How do I set or clear an environment variable?</a>
|
||||
|
||||
- <a href='#faq-login-cmd'>How do I run a command every login? What's fish's equivalent to `.bashrc`?</a>
|
||||
|
||||
- <a href='#faq-prompt'>How do I set my prompt?</a>
|
||||
|
||||
- <a href='#faq-cmd-history'>How do I run a command from history?</a>
|
||||
|
||||
- <a href='#faq-subcommand'>How do I run a subcommand? The backtick doesn't work!</a>
|
||||
|
||||
- <a href='#faq-exit-status'>How do I get the exit status of a command?</a>
|
||||
|
||||
- <a href='#faq-single-env'>How do I set an environment variable for just one command?</a>
|
||||
|
||||
- <a href='#faq-customize-colors'>How do I customize my syntax highlighting colors?</a>
|
||||
|
||||
- <a href='#faq-update-manpage-completions'>How do I update man page completions?</a>
|
||||
|
||||
- <a href='#faq-cwd-symlink'>Why does cd, pwd and other fish commands always resolve symlinked directories to their canonical path?</a>
|
||||
|
||||
- <a href='#faq-cd-implicit'>I accidentally entered a directory path and fish changed directory. What happened?</a>
|
||||
|
||||
- <a href='#faq-open'>The open command doesn't work.</a>
|
||||
|
||||
- <a href='#faq-default'>How do I make fish my default shell?</a>
|
||||
|
||||
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
|
||||
|
||||
- <a href='#faq-greeting'>How do I change the greeting message?</a>
|
||||
|
||||
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
|
||||
|
||||
- <a href='#faq-uninstalling'>How do I uninstall fish?</a>
|
||||
|
||||
\htmlonly[block]
|
||||
|
@ -81,7 +65,7 @@ You can also use the Web configuration tool, <a href="commands.html#fish_config"
|
|||
|
||||
\section faq-cmd-history How do I run a command from history?
|
||||
|
||||
Type some part of the command, and then hit the up or down arrow keys to navigate through history matches.
|
||||
Type some part of the command, and then hit the @cursor_key{↑,up} or @cursor_key{↓,down} arrow keys to navigate through history matches.
|
||||
|
||||
|
||||
\section faq-subcommand How do I run a subcommand? The backtick doesn't work!
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
\subsection functions-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
functions [-a | --all] [-n | --names]
|
||||
functions [ -a | --all ] [ -n | --names ]
|
||||
functions -c OLDNAME NEWNAME
|
||||
functions -d DESCRIPTION FUNCTION
|
||||
functions [-eq] FUNCTIONS...
|
||||
functions [ -e | -q ] FUNCTIONS...
|
||||
\endfish
|
||||
|
||||
\subsection functions-description Description
|
||||
|
|
|
@ -42,17 +42,11 @@ Every program on your computer can be used as a command in `fish`. If the progra
|
|||
Here is a list of some useful commands:
|
||||
|
||||
- `cd`, change the current directory
|
||||
|
||||
- `ls`, list files and directories
|
||||
|
||||
- `man`, display a manual page on the screen
|
||||
|
||||
- `mv`, move (rename) files
|
||||
|
||||
- `cp`, copy files
|
||||
|
||||
- `open`, open files with the default application associated with each filetype
|
||||
|
||||
- `less`, list the contents of files
|
||||
|
||||
Commands and parameters are separated by the space character ' '. Every command ends with either a newline (i.e. by pressing the return key) or a semicolon '`;`'. More than one command can be written on the same line by separating them with semicolons.
|
||||
|
@ -86,61 +80,33 @@ would remove the two files 'cumbersome' and 'filename.txt'.
|
|||
Some characters can not be written directly on the command line. For these characters, so called escape sequences are provided. These are:
|
||||
|
||||
- '<code>\\a</code>' escapes the alert character
|
||||
|
||||
- '<code>\\b</code>' escapes the backspace character
|
||||
|
||||
- '<code>\\e</code>' escapes the escape character
|
||||
|
||||
- '<code>\\f</code>' escapes the form feed character
|
||||
|
||||
- '<code>\\n</code>' escapes a newline character
|
||||
|
||||
- '<code>\\r</code>' escapes the carriage return character
|
||||
|
||||
- '<code>\\t</code>' escapes the tab character
|
||||
|
||||
- '<code>\\v</code>' escapes the vertical tab character
|
||||
|
||||
- '<code>\\ </code>' escapes the space character
|
||||
|
||||
- '<code>\\$</code>' escapes the dollar character
|
||||
|
||||
- '<code>\\\\</code>' escapes the backslash character
|
||||
|
||||
- '<code>\\*</code>' escapes the star character
|
||||
|
||||
- '<code>\\?</code>' escapes the question mark character
|
||||
|
||||
- '<code>\\~</code>' escapes the tilde character
|
||||
|
||||
- '<code>\\%</code>' escapes the percent character
|
||||
|
||||
- '<code>\\#</code>' escapes the hash character
|
||||
|
||||
- '<code>\\(</code>' escapes the left parenthesis character
|
||||
|
||||
- '<code>\\)</code>' escapes the right parenthesis character
|
||||
|
||||
- '<code>\\{</code>' escapes the left curly bracket character
|
||||
|
||||
- '<code>\\}</code>' escapes the right curly bracket character
|
||||
|
||||
- '<code>\\[</code>' escapes the left bracket character
|
||||
|
||||
- '<code>\\]</code>' escapes the right bracket character
|
||||
|
||||
- '<code>\\</code>' escapes the less than character
|
||||
|
||||
- '<code>\\\></code>' escapes the more than character
|
||||
|
||||
- '<code>\\^</code>' escapes the circumflex character
|
||||
|
||||
- '<code>\\&</code>' escapes the ampersand character
|
||||
|
||||
- '<code>\\;</code>' escapes the semicolon character
|
||||
|
||||
- '<code>\\"</code>' escapes the quote character
|
||||
|
||||
- '<code>\\'</code>' escapes the apostrophe character
|
||||
|
||||
- '<code>\\x<i>xx</i></code>', where <code><i>xx</i></code> is a hexadecimal number, escapes the ascii character with the specified value. For example, `\x9` is the tab character.
|
||||
|
@ -163,9 +129,7 @@ the tab character
|
|||
Most programs use three input/output (IO) streams, each represented by a number called a file descriptor (FD). These are:
|
||||
|
||||
- Standard input, FD 0, for reading, defaults to reading from the keyboard.
|
||||
|
||||
- Standard output, FD 1, for writing, defaults to writing to the screen.
|
||||
|
||||
- Standard error, FD 2, for writing errors and warnings, defaults to writing to the screen.
|
||||
|
||||
The reason for providing for two output file descriptors is to allow
|
||||
|
@ -432,11 +396,11 @@ When an argument for a program is given on the commandline, it undergoes the pro
|
|||
|
||||
If a star (`*`) or a question mark (`?`) is present in the parameter, `fish` attempts to match the given parameter to any files in such a way that:
|
||||
|
||||
- '`?`' can match any single character except '/'.
|
||||
- `?` can match any single character except '/'.
|
||||
|
||||
- '`*`' can match any string of characters not containing '/'. This includes matching an empty string.
|
||||
- `*` can match any string of characters not containing '/'. This includes matching an empty string.
|
||||
|
||||
- '`**`' matches any string of characters. This includes matching an empty string. The string may include the '/' character but does not need to.
|
||||
- `**` matches any string of characters. This includes matching an empty string. The string may include the `/` character but does not need to.
|
||||
|
||||
Wildcard matches are sorted case insensitively. When sorting matches containing numbers, consecutive digits are considered to be one element, so that the strings '1' '5' and '12' would be sorted in the order given.
|
||||
|
||||
|
@ -613,13 +577,9 @@ All of the above expansions can be combined. If several expansions result in mor
|
|||
When combining multiple parameter expansions, expansions are performed in the following order:
|
||||
|
||||
- Command substitutions
|
||||
|
||||
- Variable expansions
|
||||
|
||||
- Bracket expansion
|
||||
|
||||
- Pid expansion
|
||||
|
||||
- Wildcard expansion
|
||||
|
||||
Expansions are performed from right to left, nested bracket expansions are performed from the inside and out.
|
||||
|
@ -653,6 +613,7 @@ There are three kinds of variables in fish: universal, global and local variable
|
|||
Variables can be explicitly set to be universal with the `-U` or `--universal` switch, global with the `-g` or `--global` switch, or local with the `-l` or `--local` switch. The scoping rules when creating or updating a variable are:
|
||||
|
||||
-# If a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
|
||||
|
||||
-# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the variable scope is not changed.
|
||||
|
||||
-# If a variable is not explicitly set to be either universal, global or local and has never before been defined, the variable will be local to the currently executing function. Note that this is different from using the `-l` or `--local` flag. If one of those flags is used, the variable will be local to the most inner currently executing block, while without these the variable will be local to the function. If no function is executing, the variable will be global.
|
||||
|
@ -685,7 +646,7 @@ To see universal variables in action, start two fish sessions side by side, and
|
|||
|
||||
When calling a function, all current local variables temporarily disappear. This shadowing of the local scope is needed since the variable namespace would become cluttered, making it very easy to accidentally overwrite variables from another function.
|
||||
|
||||
For example, the following code will output '`Avast, mateys`':
|
||||
For example:
|
||||
|
||||
\fish
|
||||
function shiver
|
||||
|
@ -700,6 +661,8 @@ function avast
|
|||
echo $phrase
|
||||
end
|
||||
avast
|
||||
|
||||
# Outputs "Avast, mateys"
|
||||
\endfish
|
||||
|
||||
|
||||
|
@ -1057,11 +1020,8 @@ end
|
|||
Detected errors include:
|
||||
|
||||
- Non existing commands.
|
||||
|
||||
- Reading from or appending to a non existing file.
|
||||
|
||||
- Incorrect use of output redirects
|
||||
|
||||
- Mismatched parenthesis
|
||||
|
||||
|
||||
|
@ -1118,13 +1078,9 @@ If a function named `fish_greeting` exists, it will be run when entering interac
|
|||
When defining a new function in fish, it is possible to make it into an event handler, i.e. a function that is automatically run when a specific event takes place. Events that can trigger a handler currently are:
|
||||
|
||||
- When a signal is delivered
|
||||
|
||||
- When a process or job exits
|
||||
|
||||
- When the value of a variable is updated
|
||||
|
||||
- When the prompt is about to be shown
|
||||
|
||||
- When a command lookup fails
|
||||
|
||||
Example:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
\subsection nextd-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
nextd [-l | --list] [POS]
|
||||
nextd [ -l | --list ] [POS]
|
||||
\endfish
|
||||
|
||||
\subsection nextd-description Description
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
\subsection psub-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
COMMAND1 (COMMAND2 | psub [-f])
|
||||
COMMAND1 ( COMMAND2 | psub [-f] )
|
||||
\endfish
|
||||
|
||||
\subsection psub-description Description
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
set [SCOPE_OPTIONS]
|
||||
set [OPTIONS] VARIABLE_NAME VALUES...
|
||||
set [OPTIONS] VARIABLE_NAME[INDICES]... VALUES...
|
||||
set (-q | --query) [SCOPE_OPTIONS] VARIABLE_NAMES...
|
||||
set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME
|
||||
set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
|
||||
set ( -q | --query ) [SCOPE_OPTIONS] VARIABLE_NAMES...
|
||||
set ( -e | --erase ) [SCOPE_OPTIONS] VARIABLE_NAME
|
||||
set ( -e | --erase ) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
|
||||
\endfish
|
||||
|
||||
\subsection set-description Description
|
||||
|
|
|
@ -5,49 +5,27 @@
|
|||
<div class="menu tutorial_menu">
|
||||
\endhtmlonly
|
||||
- <a href="#tut_why_fish">Why fish?</a>
|
||||
|
||||
- <a href="#tut_learning_Fish">Learning fish</a>
|
||||
|
||||
- <a href="#tut_running_commands">Running Commands</a>
|
||||
|
||||
- <a href="#tut_getting_help">Getting Help</a>
|
||||
|
||||
- <a href="#tut_syntax_highlighting">Syntax Highlighting</a>
|
||||
|
||||
- <a href="#tut_wildcards">Wildcards</a>
|
||||
|
||||
- <a href="#tut_pipes_and_redirections">Pipes and Redirections</a>
|
||||
|
||||
- <a href="#tut_autosuggestions">Autosuggestions</a>
|
||||
|
||||
- <a href="#tut_tab_completions">Tab Completions</a>
|
||||
|
||||
- <a href="#tut_variables">Variables</a>
|
||||
|
||||
- <a href="#tut_exit_status">Exit Status</a>
|
||||
|
||||
- <a href="#tut_exports">Shell Variables</a>
|
||||
|
||||
- <a href="#tut_lists">Lists</a>
|
||||
|
||||
- <a href="#tut_command_substitutions">Command Substitutions</a>
|
||||
|
||||
- <a href="#tut_combiners">Combiners (And, Or, Not)</a>
|
||||
|
||||
- <a href="#tut_conditionals">Conditionals (If, Else, Switch)</a>
|
||||
|
||||
- <a href="#tut_functions">Functions</a>
|
||||
|
||||
- <a href="#tut_loops">Loops</a>
|
||||
|
||||
- <a href="#tut_prompt">Prompt</a>
|
||||
|
||||
- <a href="#tut_path">$PATH</a>
|
||||
|
||||
- <a href="#tut_startup">Startup</a>
|
||||
|
||||
- <a href="#tut_autoload">Autoloading Functions</a>
|
||||
|
||||
- <a href="#tut-more">Ready for more?</a>
|
||||
|
||||
\htmlonly[block]
|
||||
|
@ -76,7 +54,7 @@ When you start `fish`, you should see this:
|
|||
\fish{cli-dark}
|
||||
<outp>Welcome to fish, the friendly interactive shell</outp>
|
||||
<outp>Type <span class="cwd">help</span> for instructions on how to use fish</outp>
|
||||
<asis>you@hostname</asis> ~>___
|
||||
<asis>you@hostname</asis> ~>____
|
||||
\endfish
|
||||
|
||||
`fish` comes with a default prompt that shows your username, hostname, and working directory. You'll see <a href="#tut_prompt">how to change your prompt</a> further down. From now on, we'll pretend your prompt is just a '`>`' to save space.
|
||||
|
@ -131,7 +109,7 @@ A command may be invalid because it does not exist, or refers to a file that you
|
|||
`fish` will underline valid file paths as you type them:
|
||||
|
||||
\fish{cli-dark}
|
||||
>_ cat <u>~/somefi</u>__
|
||||
>_ cat <u>~/somefi</u>___
|
||||
\endfish
|
||||
|
||||
This tells you that there exists a file that starts with '`somefi`', which is useful feedback as you type.
|
||||
|
@ -190,19 +168,19 @@ stdin and stdout can be redirected via the familiar < and >. Unlike other
|
|||
`fish` suggests commands as you type, and shows the suggestion to the right of the cursor, in gray. For example:
|
||||
|
||||
\fish{cli-dark}
|
||||
>_ <error>/bin/h</error><s>__ostname</s>
|
||||
>_ <error>/bin/h</error><s>___ostname</s>
|
||||
\endfish
|
||||
|
||||
It knows about paths and options:
|
||||
|
||||
\fish{cli-dark}
|
||||
>_ grep --i<s>__gnore-case</s>
|
||||
>_ grep --i<s>___gnore-case</s>
|
||||
\endfish
|
||||
|
||||
And history too. Type a command once, and you can re-summon it by just typing a few letters:
|
||||
|
||||
\fish{cli-dark}
|
||||
>_ <error>r</error><s>__sync -avze ssh . myname@somelonghost.com:/some/long/path/doo/dee/doo/dee/doo</s>
|
||||
>_ <error>r</error><s>___sync -avze ssh . myname@somelonghost.com:/some/long/path/doo/dee/doo/dee/doo</s>
|
||||
\endfish
|
||||
|
||||
To accept the autosuggestion, hit right arrow or @key{Control,F}. To accept a single word of the autosuggestion, @key{Alt,→} (right arrow). If the autosuggestion is not what you want, just ignore it.
|
||||
|
@ -512,7 +490,7 @@ You can define your own prompt:
|
|||
>_ function fish_prompt
|
||||
echo "New Prompt % "
|
||||
end
|
||||
New Prompt % __
|
||||
<asis>New Prompt % </asis>___
|
||||
\endfish
|
||||
|
||||
Multiple lines are OK. Colors can be set via `set_color`, passing it named ANSI colors, or hex RGB values:
|
||||
|
@ -526,7 +504,7 @@ Multiple lines are OK. Colors can be set via `set_color`, passing it named ANSI
|
|||
set_color normal
|
||||
end
|
||||
<span style="color: purple">02/06/13</span>
|
||||
<span style="color: #FF0">/home/tutorial ></span>__
|
||||
<span style="color: #FF0">/home/tutorial ></span>___
|
||||
\endfish
|
||||
|
||||
You can choose among some sample prompts by running `fish_config prompt`. `fish` also supports RPROMPT through `fish_right_prompt`.
|
||||
|
|
|
@ -138,12 +138,14 @@ h3 {
|
|||
margin-right: 2px;
|
||||
}
|
||||
.key em, .key b {
|
||||
padding: 0 4px;
|
||||
padding: 1px 4px;
|
||||
background-color: #fafafa;
|
||||
border: 1px solid #aaa;
|
||||
background: linear-gradient(to bottom, #eee 0%,#fafafa 100%);
|
||||
border: 1px solid #bbb;
|
||||
border-radius: 3px;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
box-shadow: 0 1px 2px #ddd;
|
||||
}
|
||||
tt, code, pre, .fish {
|
||||
font-family: "DejaVu Sans Mono", Menlo, Monaco, "Source Code Pro", "Ubuntu Mono", "Consolas", "Lucida Console", monospace, fixed;
|
||||
|
|
|
@ -193,25 +193,26 @@ s/@sgst{\([^}]*\)}/\\\
|
|||
#.
|
||||
# Command/Function options
|
||||
# Short options
|
||||
s/-\([A-Za-z]\)\([^A-Za-z}]\)/\\\
|
||||
s/ -\([A-Za-z][A-Za-z]*\)\([^A-Za-z}]\)/ \\\
|
||||
<@opts{-\1}\
|
||||
\2/g
|
||||
#.
|
||||
# Long options
|
||||
s/--\([A-Za-z][A-Za-z0-9=_-]*\)\([^A-Za-z0-9=_-]*\)/\\\
|
||||
s/ --\([A-Za-z][A-Za-z0-9=_-]*\)\([^A-Za-z0-9=_-]*\)/ \\\
|
||||
<@opts{--\1}\
|
||||
\2/g
|
||||
#.
|
||||
# Prompt
|
||||
s/~>_/\\\
|
||||
<@prmt{~}\
|
||||
/
|
||||
<@prmt{\
|
||||
<@path{~}\
|
||||
}/
|
||||
s/^>_/@prmt/
|
||||
#.
|
||||
# Cursor
|
||||
#.
|
||||
s/__$/@curs/
|
||||
s/__\(.\)/\\\
|
||||
s/___$/@curs/
|
||||
s/___\(.\)/\\\
|
||||
<@curs{\1}\
|
||||
/
|
||||
#.
|
||||
|
@ -223,17 +224,16 @@ s/__\(.\)/\\\
|
|||
# Normal Directory
|
||||
s|mkdir |mkdir :|
|
||||
s|\([~/:][/]*[.A-Za-z_0-9/-]*\)\\ |\1=|g
|
||||
s|\([~/:][/]*[.A-Za-z_0-9/=-]*\)|\\\
|
||||
s| \([~/][/]*[.A-Za-z_0-9/=-]*\)| \\\
|
||||
<@path{\1}\
|
||||
|g
|
||||
t protect
|
||||
s| \(:[/]*[.A-Za-z_0-9/=-]*\)|\\\
|
||||
s| \(:[/]*[.A-Za-z_0-9/=-]*\)| \\\
|
||||
<@path{\1}\
|
||||
|g
|
||||
t protect
|
||||
#.
|
||||
# Dot Relative Directory (no spaces in path)
|
||||
s| *\(./[A-Za-z_0-9/-]*\)| \\\
|
||||
s| \(./[A-Za-z_0-9/-]*\)| \\\
|
||||
<@path{\1}\
|
||||
|g
|
||||
b protect
|
||||
|
@ -241,14 +241,28 @@ b protect
|
|||
# Tidy up. Merge back 'pure' entities from hold space.
|
||||
:tidy
|
||||
#.
|
||||
# Convert loose text to arguments
|
||||
s/ \([a-zA-Z0-9+%*.-][{},a-zA-Z0-9%*._/?!=-]*\)/ @args{\1}/g
|
||||
#.
|
||||
# Or when tight to a newline
|
||||
s|\n\([a-zA-Z0-9+%*.-][{},a-zA-Z0-9%*._/?!-]*\)|\
|
||||
@args{\1}|g
|
||||
#.
|
||||
# Or when tight to the beginning
|
||||
s|^\([a-zA-Z][{},a-zA-Z0-9%*._/?!-]*\)|@args{\1}|g
|
||||
#.
|
||||
# Pick up loose text after markup.
|
||||
s/\([})]\)\([a-zA-Z0-9+%*.,][,a-zA-Z0-9%*._/?!-]*\);/\1@args{\2};/g
|
||||
s/\([})]\)\([a-zA-Z0-9+%*.,][,a-zA-Z0-9%*._/?!-]*\)$/\1@args{\2}/g
|
||||
#.
|
||||
# Uncomment the following 2 lines (ss) to log the pattern buffer.
|
||||
s/^.*$/PATT: &/w lexicon.log
|
||||
s/^PATT: //
|
||||
s/^.*$/Pattern : &/w lexicon.log
|
||||
s/^Pattern : //
|
||||
#.
|
||||
# Uncomment the following 4 lines (xssx) to log the hold buffer.
|
||||
x
|
||||
s/^.*$/HOLD: &/w lexicon.log
|
||||
s/^HOLD: //
|
||||
s/^.*$/HoldBufr: &/w lexicon.log
|
||||
s/^HoldBufr: //
|
||||
x
|
||||
#.
|
||||
# Tack the hold space to the end of the pattern buffer.
|
||||
|
@ -265,9 +279,9 @@ t join
|
|||
# Clean up stray new lines
|
||||
s/\n//g
|
||||
#.
|
||||
# Uncomment the folowing two lines (ss) to log the buffer join.
|
||||
s/^.*$/PCLN: &/w lexicon.log
|
||||
s/^PCLN: //
|
||||
# Uncomment the folowing two lines (ss) to log the buffer before 'cleaning'.
|
||||
s/^.*$/PreClean: &/w lexicon.log
|
||||
s/^PreClean: //
|
||||
# Clean up special cases
|
||||
#.
|
||||
/@blah/{
|
||||
|
@ -277,14 +291,22 @@ s/^PCLN: //
|
|||
}
|
||||
/@dblq/{
|
||||
:cleandblq
|
||||
s/\(dblq{[^@<]*\)<*@...[^q]{\([^}]*\)}/\1\2/
|
||||
s/\(dblq{[^@}<]*\)[<]*@...[^q]{\([^}]*\)}/\1\2/
|
||||
t cleandblq
|
||||
}
|
||||
/@sglq/{
|
||||
:cleansglq
|
||||
s/\(sglq{[^@<]*\)<*@...[^q]{\([^}]*\)}/\1\2/
|
||||
s/\(sglq{[^@}<]*\)[<]*@...[^q]{\([^}]*\)}/\1\2/
|
||||
t cleansglq
|
||||
}
|
||||
/@vars/{
|
||||
:cleanvars
|
||||
s/\(vars{@optr{$}[^@}]*\)@cmnd{\([^}]*\)}/\1\2/
|
||||
s/\(vars{@optr{$}[^@}]*\)@func{\([^}]*\)}/\1\2/
|
||||
s/\(vars{@optr{$}[^@}]*\)@sbin{\([^}]*\)}/\1\2/
|
||||
s/\(vars{@optr{$}[^@}]*\)@args{\([^}]*\)}/\1\2/
|
||||
t cleanvars
|
||||
}
|
||||
/@redr/{
|
||||
:cleanredr
|
||||
s/\(redr{[^@}]*\)@cmnd{\([^}]*\)}/\1\2/
|
||||
|
@ -298,8 +320,11 @@ s/^PCLN: //
|
|||
s/@sgst{<@/@sgst{@/
|
||||
:cleansgst
|
||||
s/\(sgst{@curs{.}[^@]*\)@cmnd{\([^}]*\)}/\1\2/
|
||||
s/\(sgst{@curs{.}[^@]*\)@func{\([^}]*\)}/\1\2/
|
||||
s/\(sgst{@curs{.}[^@]*\)@sbin{\([^}]*\)}/\1\2/
|
||||
s/\(sgst{@curs{.}[^@]*\)@opts{\([^}]*\)}/\1\2/
|
||||
s/\(sgst{@curs{.}[^@]*\)@path{\([^}]*\)}/\1\2/
|
||||
s/\(sgst{@curs{.}[^@]*\)@args{\([^}]*\)}/\1\2/
|
||||
s/\(sgst{@curs{.}[^@]*\)@fsfo{\([^}]*\)}/\1\2/
|
||||
t cleansgst
|
||||
}
|
||||
|
@ -332,9 +357,9 @@ s/^PCLN: //
|
|||
#.
|
||||
# 'if' and 'for' seem to be special cases
|
||||
#.
|
||||
# Uncomment the folowing two lines (ss) to log the buffer join.
|
||||
s/^.*$/PREQ: &/w lexicon.log
|
||||
s/^PREQ: //
|
||||
# Uncomment the folowing two lines (ss) to log the buffer before semantic conversion.
|
||||
s/^.*$/PreArgs : &/w lexicon.log
|
||||
s/^PreArgs : //
|
||||
#.
|
||||
# Find initial commands/functions/binaries
|
||||
#.
|
||||
|
@ -347,22 +372,88 @@ x
|
|||
s/^@prmt *//
|
||||
}
|
||||
#.
|
||||
# Special case for one-line 'if' statements
|
||||
/@cmnd{if}/ {
|
||||
s//@xcmd{if}/
|
||||
s/@cmnd{set}/@xcmd{set}/
|
||||
s/@cmnd{not}/@xcmd{not}/
|
||||
s/@cmnd{else}/@xcmd{else}/
|
||||
s/@cmnd{contains}/@xcmd{contains}/
|
||||
s/@cmnd{test}/@xcmd{test}/
|
||||
s/@cmnd{end}/@xcmd{end}/
|
||||
s/@sbin{grep}/@xbin{grep}/
|
||||
}
|
||||
# one-line 'for' statements
|
||||
/@cmnd{for}/ {
|
||||
s//@xcmd{for}/
|
||||
s/@args{in}/@xcmd{in}/
|
||||
}
|
||||
# one-line 'begin' statements
|
||||
/@cmnd{begin}/ {
|
||||
s//@xcmd{begin}/
|
||||
s/@cmnd{end}/@xcmd{end}/
|
||||
}
|
||||
# one-line 'break' statements
|
||||
/@cmnd{break}/ {
|
||||
s//@xcmd{break}/
|
||||
s/@cmnd{end}/@xcmd{end}/
|
||||
}
|
||||
# one-line 'continue' statements
|
||||
/@cmnd{continue}/ {
|
||||
s//@xcmd{continue}/
|
||||
s/@cmnd{end}/@xcmd{end}/
|
||||
}
|
||||
# one-line 'switch' statements
|
||||
/@cmnd{switch}/ {
|
||||
s//@xcmd{switch}/
|
||||
s/@cmnd{case}/@xcmd{case}/
|
||||
s/@cmnd{end}/@xcmd{end}/
|
||||
}
|
||||
# one-line 'function' statements
|
||||
/@cmnd{function}/ {
|
||||
s//@xcmd{function}/
|
||||
s/@cmnd{return}/@xcmd{return}/
|
||||
s/@cmnd{end}/@xcmd{end}/
|
||||
}
|
||||
# one-line 'bind' statements - special input functions
|
||||
/@cmnd{bind}/ {
|
||||
s//@xcmd{bind}/
|
||||
s/@....{\([a-z]*\)}\(-[a-z-]*\)/@args{\1\2}/
|
||||
}
|
||||
# one-line 'builtin' statements
|
||||
s/@cmnd{builtin} @cmnd/@xcmd{builtin} @xcmd/g
|
||||
s/@cmnd{builtin} @sbin/@xcmd{builtin} @xbin/g
|
||||
s/@cmnd{builtin} @func/@xcmd{builtin} @xfnc/g
|
||||
#.
|
||||
# one-line 'command' statements
|
||||
s/@cmnd{command} @cmnd/@xcmd{command} @xcmd/g
|
||||
s/@cmnd{command} @sbin/@xcmd{command} @xbin/g
|
||||
s/@cmnd{command} @func/@xcmd{command} @xfnc/g
|
||||
#.
|
||||
# one-line 'and/or' statements
|
||||
s/@cmnd{and} @cmnd/@xcmd{and} @xcmd/g
|
||||
s/@cmnd{and} @sbin/@xcmd{and} @xbin/g
|
||||
s/@cmnd{and} @func/@xcmd{and} @xfnc/g
|
||||
s/@cmnd{or} @cmnd/@xcmd{or} @xcmd/g
|
||||
s/@cmnd{or} @sbin/@xcmd{or} @xbin/g
|
||||
s/@cmnd{or} @func/@xcmd{or} @xfnc/g
|
||||
#.
|
||||
s/^\( *\)@sbin/\1@xbin/
|
||||
s/\( *[;()] *\)@sbin/\1@xbin/
|
||||
s/\( *@redr{|} *\)@sbin/\1@xbin/
|
||||
s/\( *[;()] *\)@sbin/\1@xbin/g
|
||||
s/\( *@redr{|} *\)@sbin/\1@xbin/g
|
||||
s/^\( *\)@cmnd/\1@xcmd/
|
||||
s/\( *[;()] *\)@cmnd/\1@xcmd/
|
||||
s/\( *@redr{|} *\)@cmnd/\1@xcmd/
|
||||
s/\( *[;()] *\)@cmnd/\1@xcmd/g
|
||||
s/\( *@redr{|} *\)@cmnd/\1@xcmd/g
|
||||
s/^\( *\)@func/\1@xfnc/
|
||||
s/\( *[;()] *\)@func/\1@xfnc/
|
||||
s/\( *@redr{|} *\)@func/\1@xfnc/
|
||||
|
||||
s/\( *[;()] *\)@func/\1@xfnc/g
|
||||
s/\( *@redr{|} *\)@func/\1@xfnc/g
|
||||
s/\\@cmnd{\([^}]*\)/@args{@bksl{\1}/g
|
||||
s/@cmnd/@args/g
|
||||
s/@func/@args/g
|
||||
s/@sbin/@args/g
|
||||
|
||||
s/^.*$/PSTQ: &/w lexicon.log
|
||||
s/^PSTQ: //
|
||||
#.
|
||||
s/^.*$/PostArgs: &/w lexicon.log
|
||||
s/^PostArgs: //
|
||||
#.
|
||||
s/xcmd/cmnd/g
|
||||
s/xfnc/func/g
|
||||
|
@ -382,10 +473,16 @@ x
|
|||
s/</\</g
|
||||
s/>/\>/g
|
||||
s/((d))/@/g
|
||||
s/\\\([()]\)/@optr{@bksl{\1}}/g
|
||||
s/\([()]\)/@optr{\1}/g
|
||||
s/\\n/@bksl{n}/
|
||||
#.
|
||||
# Uncomment the folowing two lines (ss) to log the final output, sent to Doxygen.
|
||||
s/^.*$/OUT : &/w lexicon.log
|
||||
s/^OUT : //
|
||||
s/^.*$/Output : &\
|
||||
\
|
||||
/w lexicon.log
|
||||
s/^Output : //
|
||||
s/\n\n$//
|
||||
#.
|
||||
# Lines are reassembled, so branch to end
|
||||
b
|
||||
|
@ -397,6 +494,8 @@ b
|
|||
#.
|
||||
# Move protected content to hold space and mark up other entities.
|
||||
:protect
|
||||
s/^.*$/Input : &/w lexicon.log
|
||||
s/^Input : //
|
||||
h
|
||||
# Clear out any content that has already been marked up, to prevent futher
|
||||
# markup on words that should be left alone.
|
||||
|
@ -413,9 +512,9 @@ s/\n$//g
|
|||
x
|
||||
/^\<@[^}]*$/ ! {
|
||||
s/[^\<]*//
|
||||
s/^ *\\\n//
|
||||
s/[()] \\//
|
||||
s/\n *\\//
|
||||
s/^ *\\\n//g
|
||||
s/\n *\\//g
|
||||
s/[()] \\//g
|
||||
s/^[^\<][^@][^\\]*//
|
||||
s/\n[]|;) ][^\\]*\\//
|
||||
s/\n[]|;) a-zA-z0-9-][^\\]*$//
|
||||
|
@ -433,6 +532,7 @@ x
|
|||
s/\\\n/\
|
||||
/
|
||||
s/\< \n//
|
||||
s/^[a-z][a-z]* \n//
|
||||
#.
|
||||
# Swap the buffers back.
|
||||
x
|
||||
|
@ -446,8 +546,11 @@ s/\([^{<>^] *\)\([0-9]* *[<>^][<>^]*[^@][a-zA-Z0-9._-]*\)/\1@redr{\2}/g
|
|||
s/\\}/}\\/g
|
||||
#.
|
||||
# Now we can add in 'unsafe' entities that would be too greedy.
|
||||
# Arrays
|
||||
s/[[][0-9$a-zA-Z_;. -]*]/@args{&}/g
|
||||
#.
|
||||
# Declared Variables
|
||||
s/\([$%][$%]*\)\([A-Za-z_0-9][A-Za-z_0-9]*\)/@vars{@optr{\1}\2}/g
|
||||
s/\($[$]*\)\([A-Za-z_0-9][A-Za-z_0-9]*\)/@vars{@optr{\1}\2}/g
|
||||
#.
|
||||
# Files
|
||||
s/\([^@]\)\([A-Za-z0-9_-][A-Za-z0-9_-]*\.[a-z0-9*][a-z0-9*]*\)/\1@fsfo{\2}/g
|
||||
|
@ -492,3 +595,14 @@ s/\(@path{[^}]*\)}@fsfo/\1}@fsfo/
|
|||
# single line.
|
||||
#.
|
||||
# b tidy
|
||||
#.
|
||||
#.
|
||||
# Below is a special section that adds vocabuarly to the lexicon during 'make'.
|
||||
# As the lexicon is written into the output lexicon_filter, portability is
|
||||
# automatically handled.
|
||||
#.
|
||||
#!# sbin whoami
|
||||
#!# sbin mkdir
|
||||
#!# sbin basename
|
||||
#!# cmnd sleep
|
||||
#!# args in
|
||||
|
|
Loading…
Reference in New Issue
Block a user