Getting Started with fish

Source: Internet
Author: User

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:

    1. Greeting (config config.fish):

      Set fish_greeting ' Talk is cheap. Show me the code. '

    2. Command-line prompt (~/.config/fish/functions/fish_prompt.fish is generated when the Web interface is configured and completed):

      Selection_001.png

    3. 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
    1. Syntax highlighting

      A non-existent command is displayed in red.

      Selection_001.png

      Selection_002.png

    2. Wildcard characters

      Integrate the Find command to search the artifact recursively.

      Selection_003.png

    3. 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

    4. TAB completion

      If there are more than 1 complete items, all are listed for selection.

      Selection_005.png

    5. 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

    6. 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

    7. 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

    8. Command substitution

      The usage is simple, put the command in parentheses.

      Selection_002.png

    9. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.