-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.fish
58 lines (42 loc) · 1.75 KB
/
config.fish
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
set fish_greeting ""
set fish_color_cwd cyan
set __fish_git_prompt_color_branch yellow
### For reusing .profile, see https://blog.hospodarets.com/fish-shell-the-missing-config
# REUSE ALIASES FROM ~/.bash_profile
egrep "^alias " ~/.profile | while read e
set var (echo $e | sed -E "s/^alias ([A-Za-z_-]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^alias ([A-Za-z_-]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
# evaluate variables. we can use eval because we most likely just used "$var"
set value (eval echo $value)
# set an alias
alias $var="$value"
end
# REUSE ENVIRONMENT VARIABLES FROM ~/.profile
egrep "^export " ~/.profile | while read e
set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "PATH"
# replace ":" by spaces. this is how PATH looks for Fish
set value (echo $value | sed -E "s/:/ /g")
# use eval because we need to expand the value
eval set -xg $var $value
continue
end
# evaluate variables. we can use eval because we most likely just used "$var"
set value (eval echo $value)
#echo "set -xg '$var' '$value' (via '$e')"
switch $value
case '`*`';
# executable
set NO_QUOTES (echo $value | sed -E "s/^\`(.*)\`\$/\1/")
set -x $var (eval $NO_QUOTES)
case '*'
# default
set -xg $var $value
end
end
test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish