-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.fish
297 lines (252 loc) · 11 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ ENVIROMENTS ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
set -U nvm_default_version v20.16.0
set -gx ANDROID_HOME $HOME/Android/Sdk
set -gx EDITOR nvim
set -gx MANPAGER 'nvim +Man! -c "set nowrap modifiable noreadonly buftype=nofile"'
#set -gx MANPAGER 'man'
# set -gx PAGER 'nvim +Man! -c "set nowrap modifiable noreadonly buftype=nofile"'
set -gx PAGER 'less'
set -gx BAT_PAGER 'less'
set -gx LUA_DIR /usr/bin/lua
set -gx LD_LIBRARY_PATH /opt/oracle/instantclient_21_8
set -gx XDG_CONFIG_HOME ~/.config
set -U fish_greeting
set -U ignoreeof true
set -U SXHKD_SHELL sh
set -U TERMINFO /usr/share/terminfo
set -gx CPPFLAGS "-I/opt/homebrew/opt/openjdk@17/include"
set -x JAVA_HOME (/usr/libexec/java_home -v 1.7)
bind \cd delete-char
bind \cw backward-kill-word
function fish_right_prompt
end
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ paths ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
fish_add_path -aP $snap_bin_path
fish_add_path -aP /opt/homebrew/bin
fish_add_path -aP $ANDROID_HOME/emulator
fish_add_path -aP $ANDROID_HOME/tools
fish_add_path -aP $ANDROID_HOME/tools/bin
fish_add_path -aP $ANDROID_HOME/platform-tools
fish_add_path -aP /opt/ReactNativeDebugger
fish_add_path -aP /usr/local/go/bin
fish_add_path -aP /usr/.local/bin
fish_add_path -aP /usr/bin/lua
fish_add_path -aP /usr/bin/i3
fish_add_path -aP /usr/bin/i3bar
fish_add_path -aP $HOME/go/bin
fish_add_path -aP $HOME/.cargo/bin
fish_add_path -aP $HOME/.krew/bin
fish_add_path -aP $HOME/.local/share/bob/nvim-bin
fish_add_path -aP $HOME/.local/bin/razer-cli
fish_add_path -aP $HOME/.yarn/bin
fish_add_path -aP $HOME/.local/bin
fish_add_path -aP $HOME/.local/share/nvim/mason/bin/
fish_add_path -aP /opt/homebrew/opt/openjdk@17/bin
set -x PATH "/Library/Frameworks/Python.framework/Versions/3.12/bin" "$PATH"
if [ -f '/Users/ilyapu/Downloads/google-cloud-sdk/path.fish.inc' ]; . '/Users/ilyapu/Downloads/google-cloud-sdk/path.fish.inc'; end
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ ALIASES ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ edit ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ln {this_file} ~/.config/fish/conf.d/
alias edit-aliases "nvim ~/notes/work_fish_aliases.fish"
alias edit-secrets "nvim ~/notes/work_secrets.md"
alias todo "nvim ~/notes/deals.md -c \"set signcolumn=no\""
alias notes "nvim ~/notes/notes.md -c \"set signcolumn=no\""
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ docker ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
alias d "docker"
alias dstop "sudo systemctl stop docker.socket"
function dstart
sudo systemctl start docker.service
ds
end
function ds
set containers (d ps -q)
if test -z "$containers"; echo 'there is not running containers'; return; end
d stop $containers
end
alias dc "docker-compose"
alias dcr "dc restart"
alias di "docker inspect"
alias du "dc up --force-recreate -d -V $1"
alias dub "dc up --force-recreate --build -d -V $1"
function docker-patch-nerd-font -a name
if test -z $name
docker run --rm -v ~/dotfiles/fonts/in:/in:Z -v ~/dotfiles/fonts:/out:Z nerdfonts/patcher:latest -c --careful
else
set count (count ~/dotfiles/fonts/in/*)
if count -gt 1
echo 'fonts count is more than 1'
return
end
docker run --rm -v ~/dotfiles/fonts/in:/in:Z -v ~/dotfiles/fonts:/out:Z nerdfonts/patcher -c --careful --name $name
end
rm -rf ~/dotfiles/fonts/in/*
end
alias w "watson"
alias wr "w report --day"
alias wstart "watson start"
alias wst "watson stop"
function wry
set yesterday (date +%Y-%m-%d --date='yesterday')
w report --from $yesterday --to $yesterday
end
alias g "git"
alias tn "tmux new-session -s"
alias ta "tmux attach-session"
alias td "tmux detach"
alias y "yarn"
alias grep "grep -i --color"
alias n "nvim --listen /tmp/nvim-$(tmux display-message -p '#S').pipe"
alias nman 'nvim +Man! -c "set nowrap" -c "set modifiable" -c "set noreadonly" -c "set buftype=nofile"'
alias nread 'nvim -c "set nowrap" -c "set modifiable" -c "set noreadonly" -c "set buftype=nofile"'
alias req "http -p mbh"
alias mkdir "mkdir -p"
alias less "less -MSx4 -FXR --shift 10"
alias ls "ls -A --color=auto"
alias rm "rm -rfv"
alias cp "cp -r -v"
alias htop "btop -p 1"
alias btop "btop -p 1"
alias nvim-start "nvim --startuptime _s.log -c 'q' && tail -100 _s.log | bat && rm _s.log"
alias ... "cd ../../"
alias lg "lazygit"
alias fzf "fzf --color=gutter:-1,bg+:-1,fg+:#244566,pointer:#365987 --margin=0,2 --no-separator --info=inline-right --no-scrollbar --pointer='' --prompt=' ' --layout=reverse --bind ctrl-e:close"
function gs
set result (git log --branches --source --oneline | fzf)
echo $result | nread
end
# git reflog search
function grs
git reflog show --all | fzf
end
function gd
set -l index $argv[1]
if test -z $index
set index 0
end
g a
git diff HEAD~$index | nread
end
function change-theme
set file ~/dotfiles/scripts/change_terminal_theme.fish
chmod +x $file
source $file
end
alias play:sql "n ~/play/sql/index.sql"
alias play:json "n ~/play/json/test.json"
function play:ts
cd ~/play/typescript
n index.ts
end
# brew install translate-shell
alias enru "trans en:ru -show-original no -show-prompt-message no -show-languages no"
alias ruen "trans ru:en -show-original no -show-prompt-message no -show-languages no -b"
function dl
d logs $argv -f -n 99
end
function dps
d ps -a --format "table {{.ID}}\t{{.Names}}" | \
grep $argv
end
function git-recreate-from -a root_branch
if test -z "$root_branch"; echo 'error: need a root_branch argument'; return; end
set branch (git branch --show-current)
git ch $root_branch
git bd $branch
git plh
git chb $branch
end
function gc -a message
if test -z "$message"; echo '{message} is not implemented'
return
end
set branch (git rev-parse --abbrev-ref HEAD)
set ticket (echo $branch | awk -F/ '{print $NF}')
set message (echo $message | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
git add -A
git commit -m "$ticket: $message"
end
function gp -a message
if test -z "$message"; echo '{message} is not implemented'; return; end
set branch (git branch --show-current)
git add -A
git commit -m "$message"
git push origin $branch
end
function notify:apple
osascript -e 'display notification "Finished" sound name "Blow"'
end
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ COLORS ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
set fish_color_command '#81A1C1'
set fish_color_match 'red' '--bold' '--background=cyan'
set fish_color_search_match 'red' '--bold' '--background=red'
set fish_pager_color_prefix 'red'
set fish_color_valid_path
set fish_color_selection 'green' '--background=brblack'
set fish_color_param 'cyan'
set fish_color_keyword 'cyan'
set fish_color_autosuggestion '#5c6370'
set fish_color_quote '#6e88a6'
set fish_color_history_current '--bold'
set fish_color_host red
set fish_color_normal
set fish_color_operator 'red'
# set fish_color_cancel '-r'
# set fish_color_comment red
# set fish_color_cwd green
# set fish_color_cwd_root red
# set fish_color_end brmagenta
# set fish_color_error brred
# set fish_color_escape 'red' '--italic'
# set fish_color_host_remote red
# set fish_color_redirection brblue
# set fish_color_status red
# set fish_color_user brgreen
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ TMUX ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
function refresh_tmux_vars --on-event="fish_preexec"
if set -q TMUX
tmux showenv -s | string replace -rf '^((?:SSH|DISPLAY).*?)=(".*?"); export.*' 'set -gx $1 $2' | source
end
end
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ AUTOSTART ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
zoxide init fish | source
function starship_transient_prompt_func
starship module character
end
starship init fish | source
enable_transience
#if status is-interactive
# and not set -q TMUX
# tmux kill-session -t 0 || true
# tmux attach -t main || tmux new -s main
#end
#
# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ utils ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
function util:get_git_remote_root
set url (git remote get-url origin)
set repository (echo $url | awk -F/ '{print $NF}' | awk -F. '{print $1}')
set namespace (echo $url | awk -F: '{print $2}' | awk -F/ '{print $1}')
echo "$namespace/$repository"
end
function util:get_repository_name
set url (git remote get-url origin)
echo $url | awk -F/ '{print $NF}' | awk -F. '{print $1}'
end
function open:github:current
set ticket (util:get_ticket_name)
set root (util:get_git_remote_root)
open "https://github.com/$root/pulls?q=is%3Apr+$ticket"
end
function open:github:my_prs
set root (util:get_git_remote_root)
open "https://github.com/$root/pulls/@me"
end