-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.fish
159 lines (134 loc) · 3.26 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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
set fisher_config ~/.config/fisherman
# Set SIDE_HOME env
set -xg SIDE_HOME $HOME/side
# Set a variable to tracks
set -x PLATFORM (uname)
# Set the default editor
set -x EDITOR nvim
# Use vi key binds
fish_vi_key_bindings
switch $PLATFORM
case Linux
source $SIDE_HOME/linux.fish
case Darwin
source $SIDE_HOME/darwin.fish
case FreeBSD
source $SIDE_HOME/bsd.fish
end
# Install a $HOME/local directory for installing local package
if test -e $HOME/local/bin
set -xg PATH $PATH $HOME/local/bin
end
# Path for binaries installed in home
if test -e $HOME/bin
set -xg PATH $PATH $HOME/bin
end
# tmux unicode
function utmux
tmux -u $argv
end
# Set environment variables
if test -e $HOME/bin
set -xg PATH $PATH $HOME/bin
end
if test -e $HOME/go/bin
set -xg PATH $HOME/go/bin $PATH
end
if test -e $HOME/local/go/bin
set -xg PATH $HOME/local/go/bin $PATH
set -xg GOBIN $HOME/local/bin
end
if test -e $HOME/local/ziglang
set -xg PATH $HOME/local/ziglang $PATH
end
if test -e $HOME/local/zls
set -xg PATH $PATH $HOME/local/zls
end
# Default to optimized compile c code
set -xg CFLAGS -O2
# Git alias
function gs
git status
end
# Local nim
if test -e $HOME/local/nim
set -xg PATH $PATH $HOME/local/nim/bin
end
# Dart library installed
if test -e /usr/lib/dart/bin/
set -xg PATH $PATH /usr/lib/dart/bin/
end
# Minikube
set minikube_path (which minikube)
if [ $minikube_path ]
test -x $minikube_path
function kubectl
minikube kubectl -- $argv
end
eval (minikube docker-env)
end
if test -e $HOME/.pyenv/bin/pyenv
set -xg PATH $HOME/.pyenv/bin/ $PATH
set -xg PYENV_VERSION default
end
function initpenv
# If pyenv exists then run it
set pyenv_exists (which pyenv)
if [ $pyenv_exists ]
test -x $pyenv_exists
set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths
# pyenv + virtualenv
status --is-interactive; and pyenv virtualenv-init - | source
pyenv init - | source
# Found this saves a lot of startup time (like 40%) by not calling it based on using this command
# echo '' > startup.txt && nvim --startuptime startup.txt
if test -z "$VIMRUNTIME"
pyenv rehash
end
end
end
function pyactivate
initpenv
pyenv activate $argv
end
# Use neovim if it exists
function which_editor
set nvim_path (which nvim)
if [ $nvim_path ]
test -x $nvim_path
echo nvim
else
echo vim
end
end
function e
set cmd (which_editor)
set TERM screen-256color
eval $cmd $argv
end
if test -e $SIDE_HOME/prompt.fish
source $SIDE_HOME/prompt.fish
end
if test -e $HOME/.side/config.fish
source $HOME/.side/config.fish
end
# Add current path to include path
set -xg C_INCLUDE_PATH . $C_INCLUDE_PATH
# Local zig installation
if test -e $HOME/local/zig/zig
# Add zig to path
set -xg PATH $PATH $HOME/local/zig
end
function random_string --description "random_string 32"
switch $PLATFORM
case Darwin
head -c $argv[1] </dev/random | base64
case '*'
head /dev/urandom | tr -dc A-Za-z0-9 | head -c $argv[1]
echo ''
end
end
# FZF search
# set -xg FZF_DEFAULT_COMMAND "rg --files --hidden --follow --glob '!.git'"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/home/lhj/Downloads/google-cloud-sdk/path.fish.inc' ]; . '/home/lhj/Downloads/google-cloud-sdk/path.fish.inc'; end