This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.fish
More file actions
122 lines (102 loc) · 3.15 KB
/
config.fish
File metadata and controls
122 lines (102 loc) · 3.15 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
function fish_user_key_bindings
bind -M insert -k sright nextd-or-forward-word
bind -M insert -k sleft prevd-or-backward-word
end
# disable mode prompt, since we render it ourselves in fish_prompt
function fish_mode_prompt
end
function fish_prompt
# record the status of the last command
set -l last_status $status
set -q __fish_git_prompt_showupstream
or set -g __fish_git_prompt_showupstream auto
if functions -q fish_is_root_user; and fish_is_root_user
set_color -o yellow
else
set_color -o --bold red
end
echo -n $USER
set_color -o --bold blue
echo -n @
if test -z "$SSH_CLIENT"
set_color -o --bold red
else
set_color -o --bold yellow
end
echo -n (prompt_hostname)
set_color -o blue
# TODO: highlight slashes in path
echo -n :(prompt_pwd --dir-length=5 --full-length-dirs=5)
set_color -o green
# git
set -l prompt_git (fish_git_prompt ' %s')
test -n "$prompt_git"
set_color -o --bold green
echo -n $prompt_git
set_color normal
# new line
echo
# background jobs
for job in (jobs)
set_color magenta
echo -n '> '
set_color brown
echo $job
end
# mode identifier
if test "$fish_key_bindings" = fish_vi_key_bindings
or test "$fish_key_bindings" = fish_hybrid_key_bindings
set -l mode
switch $fish_bind_mode
case default
set mode (set_color --bold blue)NORMAL
case insert
set mode (set_color --bold magenta)INSERT
case replace_one
set mode (set_color --bold green)REPLACE
echo '[R]'
case replace
set mode (set_color --bold green)REPLACE
case visual
set mode (set_color --bold green)VISUAL
end
set mode $mode(set_color normal)
echo -n $mode
end
# Show status of last command (only if it's not 0)
set -l stat
if test $last_status -ne 0
set stat (set_color red)" [$last_status]"(set_color normal)
end
set_color -o magenta
echo -n ' ❯ '
set_color normal
end
function fish_right_prompt
set_color magenta
# TODO: highlight colons and slashes in timestamp
echo (date "+%F %T %z")
end
if status is-interactive
# commands to run in interactive sessions can go here
# disable greeting
set fish_greeting
bind --mode default \cd delete-char # ignore accidental ctrl-d
bind --mode default \cd\cd\cd delete-or-exit # but still exit if pressed thrice
bind --mode insert \cd delete-char # ignore accidental ctrl-d
bind --mode insert \cd\cd\cd delete-or-exit # but still exit if pressed thrice
# enable vi key bindings
set -g fish_key_bindings fish_vi_key_bindings
# abbreviations
abbr --add e kak
abbr --add g git
abbr --add gs git status
abbr --add gd git diff
abbr --add ga git add
abbr --add gl git log --all --graph
# env variables
set -gx EDITOR kak
set -gx VISUAL $EDITOR
set -gx HELIX_RUNTIME /Users/intarga/etc/helix/runtime
set -gx CARGO_HOME /Users/intarga/.cargo
end