-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.fish
142 lines (115 loc) · 2.61 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
function source_if_exists
if test -e "$argv[1]"
source "$argv[1]"
end
end
source_if_exists ~/.config/fish/local.fish
source_if_exists ~/.asdf/asdf.fish
function sudo
if test "$argv" = !!
eval command sudo $history[1]
else
command sudo $argv
end
end
function ts-playground
function clone-and-clean
git clone git@github.com:tylerjlawson/ts-playground.git --depth 1 $argv[1]\
&& cd $argv[1]\
&& rm -rf .git\
&& code .\
&& cd ..
end
if test (count $argv) -ge 1
clone-and-clean $argv[1]
else
clone-and-clean ts-playground
end
end
function pdfman -d "manpage as pdf"
man -t $argv | pstopdf -i -o /tmp/$argv.pdf && open /tmp/$argv.pdf
end
function ...
cd ../..
end
function ....
cd ../../..
end
function rnm
mmv "$argv[1]*" "$argv[2]#1"
end
function mkcd -d "Create a directory and set CWD"
command mkdir $argv
if test $status = 0
switch $argv[(count $argv)]
case '-*'
case '*'
cd $argv[(count $argv)]
return
end
end
end
# SPECIFIC TO UBUNTU
function aptup
sudo apt update
sudo apt -y upgrade
sudo apt clean
sudo apt -y autoremove
end
# END UBUNTU SPECIFIC
function isnumber
string match -qr '^[0-9]+$' $argv
end
function update
# homebrew
brew update
brew upgrade
brew cleanup
brew doctor
# oh-my-fish for fish shell theming
omf update
end
function port
set -l testPort (lsof -t -i tcp:$argv)
if test -n "$testPort"
echo $testPort
else
echo "No process running on port: $argv"
end
end
function killport
set -l portRunning (port $argv)
if isnumber $portRunning
kill -9 $portRunning
echo "PID $portRunning killed - port $argv is now free"
else
echo $portRunning
end
end
# END MAC SPECIFIC
thefuck --alias | source
alias python="python3"
alias hg="history | grep"
alias dot="cd ~/gitspace/dotfiles"
alias gst="git status"
alias gsp="cd ~/gitspace"
alias tree="tree -C"
set -g theme_color_scheme dark
set -g theme_display_user no
set -g theme_display_ruby no
set -g fish_prompt_pwd_dir_length 0
set -g theme_display_date no
set -g theme_date_format "+%a %H:%M"
set -g theme_nerd_fonts yes
fish_add_path $HOME/bin
set NVM_DIR $HOME/.nvm
function nvm
bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
end
set -gx PNPM_HOME "$HOME/Library/pnpm"
if not string match -q -- $PNPM_HOME $PATH
set -gx PATH "$PNPM_HOME" $PATH
end
# bun
set --export BUN_INSTALL "$HOME/.bun"
set --export PATH $BUN_INSTALL/bin $PATH