1
0
Fork 0
dotfiles/fish/config.fish

94 lines
1.7 KiB
Fish
Raw Normal View History

2021-04-24 17:30:03 -07:00
#!/usr/bin/fish
2023-02-25 09:08:22 -08:00
# Variables
2022-10-08 10:11:20 -07:00
set --export GOPATH "/home/mark/Documents/go"
2022-11-03 10:54:44 -07:00
2023-02-25 09:08:22 -08:00
# Empty greeging
set fish_greeting
2021-04-24 17:30:03 -07:00
2022-07-09 08:47:29 -07:00
# Misc aliases
2023-02-25 09:08:22 -08:00
alias glog "git log --oneline --all --graph"
2021-04-24 17:30:03 -07:00
alias icat "kitty +kitten icat --align left"
2022-07-09 08:47:29 -07:00
alias ls lsd
2022-11-03 10:54:44 -07:00
alias !! $history[1]
2021-04-24 17:30:03 -07:00
2023-02-25 09:08:22 -08:00
2022-07-09 08:47:29 -07:00
# Python aliases
function mkvenv \
--description "Make a python venv"
2023-02-25 09:08:22 -08:00
# mkvenv: make venv at ./venv
2022-07-09 08:47:29 -07:00
# mkvenv <path>: make venv at path
# mkvenv <path> <prompt>: make venv at path and set prompt.
if test (count $argv) -eq 2
2022-07-09 08:52:29 -07:00
echo -n "Making virtualenv at "
set_color green
echo -n $argv[1]
set_color normal
echo -n " with prompt "
2022-07-09 08:47:29 -07:00
set_color "green"
echo -n $argv[2]
set_color normal
echo
python -m venv --prompt=$argv[2] $argv[1]
2022-07-09 08:52:29 -07:00
2023-02-25 09:08:22 -08:00
2022-07-09 08:47:29 -07:00
else if test (count $argv) -eq 1
2021-04-24 17:30:03 -07:00
2023-02-25 09:08:22 -08:00
if test -e "./venv"
set_color red
echo -n "Cannot make venv at "
set_color normal
echo -n "$argv[1]"
set_color red
echo ": path exists."
set_color normal
else
echo -n "Making virtualenv at "
set_color green
echo -n "$argv[1]"
set_color normal
echo
python -m venv $argv[1]
end
else if test (count $argv) -eq 0
mkvenv "./venv"
2022-07-09 08:52:29 -07:00
2022-07-09 08:47:29 -07:00
else
2023-02-25 09:08:22 -08:00
set_color red
2022-07-09 08:47:29 -07:00
echo "Invalid number of arguments."
2023-02-25 09:08:22 -08:00
set_color normal
2022-07-09 08:47:29 -07:00
end
end
2021-04-24 17:30:03 -07:00
2023-02-25 09:08:22 -08:00
2022-07-09 08:47:29 -07:00
function venvon \
--description "Activate a python venv. If no args are provided, assume path is 'venv'"
if test (count $argv) -eq 0
2023-02-25 09:08:22 -08:00
venvon "./venv"
2022-07-09 08:47:29 -07:00
else if test (count $argv) -eq 1
2023-02-25 09:08:22 -08:00
if test -e "$argv[1]/bin/activate.fish"
source "$argv[1]/bin/activate.fish"
else
set_color red
echo -n "Cannot find activation script, is "
set_color normal
echo -n "$argv[1]"
set_color red
echo " a venv?"
set_color normal
end
2022-07-09 08:47:29 -07:00
else
2023-02-25 09:08:22 -08:00
set_color red
2022-07-09 08:47:29 -07:00
echo "Invalid number of arguments."
2023-02-25 09:08:22 -08:00
set_color normal
2022-07-09 08:47:29 -07:00
end
end