mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
FAQ: add questions from beta site
This commit is contained in:
parent
994e9fe9de
commit
1d2cd99e96
|
@ -1,5 +1,13 @@
|
|||
/** \page faq Frequently asked questions
|
||||
|
||||
- <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 <tt>.bashrc</tt>?</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-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>
|
||||
|
@ -11,6 +19,80 @@
|
|||
|
||||
<hr>
|
||||
|
||||
\section faq-envvar How do I set or clear an environment variable?
|
||||
|
||||
Use the <a href="commands.html#set"><code>set</code></a> command:
|
||||
|
||||
<pre>set -x key value
|
||||
set -e key</pre>
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-login-cmd How do I run a command every login? What's fish's equivalent to <tt>.bashrc</tt>?
|
||||
|
||||
Edit the file <tt>~/.config/fish/config.fish</tt>, creating it if it does not
|
||||
exist. (Note the leading period.)
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-prompt How do I set my prompt?
|
||||
|
||||
The prompt is the output of the \c fish_prompt function. Put it in
|
||||
<tt>~/.config/fish/functions/fish_prompt.fish</tt>. For example, a simple
|
||||
prompt is:
|
||||
<pre>function fish_prompt
|
||||
set_color $fish_color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
echo -n ' > '
|
||||
end</pre>
|
||||
|
||||
You can also use the Web configuration tool,
|
||||
<a href="commands.html#fish_config"><code>fish_config</code></a>, to preview
|
||||
and choose from a gallery of sample prompts.
|
||||
|
||||
<hr>
|
||||
|
||||
\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.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-subcommand How do I run a subcommand? The backtick doesn't work!
|
||||
|
||||
\c fish uses parentheses for subcommands. For example:
|
||||
|
||||
<pre>for i in (ls)
|
||||
echo $i
|
||||
end</pre>
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-exit-status How do I get the exit status of a command?
|
||||
|
||||
Use the \c $status variable. This replaces the \c $? variable used in some
|
||||
other shells.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-customize-colors How do I customize my syntax highlighting colors?
|
||||
|
||||
Use the web configuration tool,
|
||||
<a href="commands.html#fish_config"><code>fish_config</code></a>, or alter the
|
||||
<a href="index.html#variables-color">\c fish_color family of environment variables</a>.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-update-manpage-completions How do I update man page completions?
|
||||
|
||||
Use the
|
||||
<a href="commands.html#fish_update_completions"><tt>fish_update_completions</tt></a>
|
||||
command.
|
||||
|
||||
<hr>
|
||||
|
||||
\section faq-cwd-symlink Why does cd, $PWD and and various fish commands always resolve symlinked directories to their canonical path?
|
||||
|
||||
<i>
|
||||
|
|
Loading…
Reference in New Issue
Block a user