Installation and Configuration
Linux and OS X Basic can be installed through the source, it is not easy to download the source code compilation, not difficult.
Installing the first step is to modify the OS default shell:
Chsh-s/usr/bin/fish
Then you can use it directly, that's it. You don't have to face Zsh's voluminous configuration files, and you don't need to go to GitHub clone a "Oh My Zsh".
Of course if you really want to configure, enter the Fish_config command to start the Web admin interface.
What the? The grid is too low to be configured manually. OK, ~/.config/fish/config.fish This is the configuration file for fish, similar to bash's. bashrc.
I like to configure three things:
Greeting (config config.fish):
Set fish_greeting ' Talk is cheap. Show me the code. '
Command-line prompt (~/.config/fish/functions/fish_prompt.fish is generated when the Web interface is configured and completed):
Selection_001.png
Set shortcut keys for accepting recommendations (third advantage):
Modify Fish_prompt.fish to add a statement: Bind \ej accept-autosuggestion. Press ALT and J at the same time to accept the recommendation.
Advantage
Syntax highlighting
A non-existent command is displayed in red.
Selection_001.png
Selection_002.png
Wildcard characters
Integrate the Find command to search the artifact recursively.
Selection_003.png
Smart Advice
When a few letters are pressed, fish will have smart suggestions and pressing the RIGHT arrow will accept the suggestion.
Selection_004.png
TAB completion
If there are more than 1 complete items, all are listed for selection.
Selection_005.png
Variable
Fish is assigned to variables by set instead of "=".
Selection_006.png
Adding a directory to path also uses Set (config Config.fish):
Set PATH $PATH/home/mountain/shell
Exports
Fish has no export order and needs to be replaced with set-x. If you need to erase a variable, execute set-e.
Selection_007.png
Selection_008.png
List
Some variables have multiple values, for example $path,fish will assemble all the values into a list that can be iterated or accessed by subscript.
Selection_001.png
Command substitution
The usage is simple, put the command in parentheses.
Selection_002.png
Grammar sugar
Fish's Common keywords (if, switch, function, etc.) are much more advanced and practical than bash, but given the inability to install fish at all in the company's production environment, the script cannot be ported, so this part can only be reluctantly discarded.
Getting Started with fish