Tuesday 19 May 2015

Fish Shell

Install fish shell using apt-get

Or you can install through debian or source code

Once you installed the fish shell you can configure it according to your needs.

Basic configuration for git is given below:


Configuration
User configurations for fish are located at ~/.config/fish/config.fish. Adding commands or functions to the file will execute/define them when opening a terminal, similar to .bashrc.

Web interface

The fish prompt and terminal colors can be set with the interactive web interface:

fish_config

Selected settings are written to your personal configuration file. You can also view defined functions and your history.

Prompt

If you would like fish to display the branch and dirty status when you are in a git directory, you can add the following to your ~/.config/fish/config.fish:

 

# fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showupstream 'yes'
set __fish_git_prompt_color_branch yellow

# Status Chars
set __fish_git_prompt_char_dirtystate '⚡'
set __fish_git_prompt_char_stagedstate '→'
set __fish_git_prompt_char_stashstate '↩'
set __fish_git_prompt_char_upstream_ahead '↑'
set __fish_git_prompt_char_upstream_behind '↓'
 
function fish_prompt
        set last_status $status
        set_color $fish_color_cwd
        printf '%s' (prompt_pwd)
        set_color normal
        printf '%s ' (__fish_git_prompt)
       set_color normal
end

 


Command completion

fish can generate autocompletions from man pages. Completions are written to ~/.config/fish/generated_completions/ and can be generated by calling:
fish_update_completions

You can also define your own completions in ~/.config/fish/completions/. See /usr/share/fish/completions/ for a few examples.

Context-aware completions for Arch Linux-specific commands like pacman, pacman-key, makepkg, cower, pbget, pacmatic are built into fish, since the policy of the fish development is to include all the existent completions in the upstream tarball. The memory management is clever enough to avoid any negative impact on resources.


Good link to know about fish:

https://wiki.archlinux.org/index.php/Fish