ubuntu18.04 安装配置fish

1.安装fish

拉取fish最新版本

sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install fish

2.安装autojump

git clone https://github.com/wting/autojump.git
cd autojump
./install.py

3. 配置fish

3.1启动文件配置

vi ~/.config/fish/config.fish


# 终端显示样式的配置
function fish_prompt --description 'Write out the prompt'
    if not set -q __fish_prompt_normal
        set -g __fish_prompt_normal (set_color normal)
    end

    __fish_git_prompt >/dev/null 2>&1

    if git_is_repo
        if not set -q __git_cb
            set __git_cb (set_color blue)" ("(set_color brred)(git branch | grep \* | sed 's/* //') (set_color -o bryellow)(__fish_git_prompt_informative_status)(set_color blue)")"
        end
    end


    if not set -q __fish_prompt_cwd
        set -g __fish_prompt_cwd (set_color $fish_color_cwd)
    end

    set_color 00ccff 
    date "+%m/%d %H:%M:%S"
    set_color purple
    printf '%s%s %s%s%s%s ' "$USER" "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $__git_cb
end



# 判断是否是git仓库的工具函数
function git_is_repo --description 'Check if directory is a repository'
  test -d .git
  or command git rev-parse --git-dir >/dev/null ^/dev/null
end

# 配置autojump
begin
    set --local AUTOJUMP_PATH $HOME/.autojump/share/autojump/autojump.fish
    if test -e $AUTOJUMP_PATH
        source $AUTOJUMP_PATH
    end
end
效果图

3.2 样式配置

fish_config
image.png

4 启动fish

我没设置默认,用的时候输下命令就行了

fish

参考:
https://www.zhihu.com/topic/20029678/hot

你可能感兴趣的:(ubuntu18.04 安装配置fish)