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倉庫的工具函數(shù)
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
4 啟動fish
我沒設(shè)置默認(rèn)疮胖,用的時候輸下命令就行了
fish