1
0
Fork 0

Improved fish scripts

master
Mark 2023-02-25 09:08:22 -08:00
parent 6ac19e2544
commit 169bca348f
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 48 additions and 21 deletions

View File

@ -1,23 +1,24 @@
#!/usr/bin/fish
set fish_greeting
# Variables
set --export GOPATH "/home/mark/Documents/go"
set --export TEXINPUTS "/home/mark/Documents/latex"
# Git aliases
alias glog "git log --oneline --all --graph"
# Empty greeging
set fish_greeting
# Misc aliases
alias glog "git log --oneline --all --graph"
alias icat "kitty +kitten icat --align left"
alias ls lsd
alias !! $history[1]
# Python aliases
function mkvenv \
--description "Make a python venv"
# mkvenv: make venv at ./venv
# mkvenv <path>: make venv at path
# mkvenv <path> <prompt>: make venv at path and set prompt.
@ -34,33 +35,59 @@ function mkvenv \
python -m venv --prompt=$argv[2] $argv[1]
else if test (count $argv) -eq 1
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]
echo -n "$argv[1]"
set_color normal
echo
python -m venv $argv[1]
end
else if test (count $argv) -eq 0
mkvenv "./venv"
else
set_color red
echo "Invalid number of arguments."
set_color normal
end
end
function venvon \
--description "Activate a python venv. If no args are provided, assume path is 'venv'"
if test (count $argv) -eq 0
source venv/bin/activate.fish
venvon "./venv"
else if test (count $argv) -eq 1
source $argv[1]/bin/activate.fish
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
else
set_color red
echo "Invalid number of arguments."
set_color normal
end
end
# Enable kitty command completion
kitty + complete setup fish | source