fish
# fish
- 启动
fish
1
- 退出
bash
1
# Centos7
# 添加下载链接
yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo
1
# 安装
yum install fish
1
# Ubuntu-18
# 更新最新源
sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
1
2
2
# 安装
sudo apt install fish
1
# autojump安装
git clone https://github.com/wting/autojump.git
cd autojump
./install.py
1
2
3
2
3
# 修改启动文件配置
vim ~/.config/fish/config.fish
1
修改:
# 终端显示样式的配置
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40