-
Notifications
You must be signed in to change notification settings - Fork 0
/
once.fish
170 lines (133 loc) · 4.44 KB
/
once.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
set -x fish_greeting
# set ssh-agent
if [ -z $SSH_AUTH_SOCK ]
if not pgrep ssh-agent > /dev/null
ssh-agent -c | head -n 2 | source
else
set -x SSH_AUTH_SOCK (ls /tmp/ssh-*/agent.*)
end
end
set -x PATH $HOME/.local/bin $PATH
set -x PATH $HOME/.../bin $PATH
# for p in (find $HOME/.apps/**/bin | ag /bin\$)
# set PATH $p $PATH
# end
set PNPM_PACKAGES "$HOME/.pnpm-packages"
set PATH $PATH $PNPM_PACKAGES/bin
set -gx PNPM_HOME "/home/user/.local/share/pnpm"
set -gx PATH "$PNPM_HOME" $PATH
set -gx FISH_HOSTNAME (string shorten -m12 (hostname))
# pyenv
if [ -d ~/.pyenv ]
set -gx PATH $HOME"/.pyenv/bin" $PATH
# . (pyenv init -|psub)
# status --is-interactive; and source (pyenv virtualenv-init -|psub)
status --is-interactive; and pyenv init - | source
status --is-interactive; and pyenv virtualenv-init - | source
end
# rbenv
if [ -d ~/.rbenv ]
set -x PATH $HOME"/.rbenv/bin" $PATH
. (rbenv init -|psub)
end
# # autojump
# [ -f /usr/share/autojump/autojump.fish ]; and source /usr/share/autojump/autojump.fish
# cargo
set -x PATH $HOME/.cargo/bin $PATH
# fzf to use ripgrep
set -x FZF_DEFAULT_COMMAND 'rg --files --hidden --follow --glob "!.git/*"'
set -x ARDUINO_PATH /usr/local/arduino
set -x LS_COLORS $LS_COLORS'ow=97;40'
set -x PATH "/opt/flutter/bin" $PATH
# set -Ux PYENV_ROOT $HOME/.pyenv
# set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths
# status is-login; and pyenv init --path | source
# pyenv init - | source
set -gx PYENV_VIRTUALENV_DISABLE_PROMPT 1
if [ -d ~/.ghcup ]
set -x PATH $HOME"/.ghcup/bin" $PATH
end
# aliases
function nvs
if [ -e Session.vim ]
# vim --servername (head --bytes 32 /dev/urandom | b2sum | head -c 32) -S
nvim --servername (pwd) -S
else
nvim --servername (pwd) -c ':Obsession'
end
end
# >>> conda initialize >>>
set -gx CONDA_EXE "/opt/miniconda3/bin/conda"
set _CONDA_ROOT "/opt/miniconda3"
set _CONDA_EXE "/opt/miniconda3/bin/conda"
set -gx CONDA_PYTHON_EXE "/opt/miniconda3/bin/python"
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
#
# INSTALL
#
# Run 'conda init fish' and restart your shell.
#
if not set -q CONDA_SHLVL
set -gx CONDA_SHLVL 0
set -g _CONDA_ROOT (dirname (dirname $CONDA_EXE))
set -gx PATH $_CONDA_ROOT/condabin $PATH
end
function __conda_add_prompt
if set -q CONDA_PROMPT_MODIFIER
set_color -o green
echo -n $CONDA_PROMPT_MODIFIER
set_color normal
end
end
function return_last_status
return $argv
end
# Autocompletions below
# Faster but less tested (?)
function __fish_conda_commands
string replace -r '.*_([a-z]+)\.py$' '$1' $_CONDA_ROOT/lib/python*/site-packages/conda/cli/main_*.py
for f in $_CONDA_ROOT/bin/conda-*
if test -x "$f" -a ! -d "$f"
string replace -r '^.*/conda-' '' "$f"
end
end
echo activate
echo deactivate
end
function __fish_conda_env_commands
string replace -r '.*_([a-z]+)\.py$' '$1' $_CONDA_ROOT/lib/python*/site-packages/conda_env/cli/main_*.py
end
function __fish_conda_envs
conda config --json --show envs_dirs | python -c "import json, os, sys; from os.path import isdir, join; print('\n'.join(d for ed in json.load(sys.stdin)['envs_dirs'] if isdir(ed) for d in os.listdir(ed) if isdir(join(ed, d))))"
end
function __fish_conda_packages
conda list | awk 'NR > 3 {print $1}'
end
function __fish_conda_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = conda ]
return 0
end
return 1
end
function __fish_conda_using_command
set cmd (commandline -opc)
if [ (count $cmd) -gt 1 ]
if [ $argv[1] = $cmd[2] ]
return 0
end
end
return 1
end
# Conda commands
complete -f -c conda -n __fish_conda_needs_command -a '(__fish_conda_commands)'
complete -f -c conda -n '__fish_conda_using_command env' -a '(__fish_conda_env_commands)'
# Commands that need environment as parameter
complete -f -c conda -n '__fish_conda_using_command activate' -a '(__fish_conda_envs)'
# Commands that need package as parameter
complete -f -c conda -n '__fish_conda_using_command remove' -a '(__fish_conda_packages)'
complete -f -c conda -n '__fish_conda_using_command uninstall' -a '(__fish_conda_packages)'
complete -f -c conda -n '__fish_conda_using_command upgrade' -a '(__fish_conda_packages)'
complete -f -c conda -n '__fish_conda_using_command update' -a '(__fish_conda_packages)'
# <<< conda initialize <<<