You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.0 KiB
90 lines
2.0 KiB
shopt -s oil:all
|
|
|
|
proc mkcd(directory) {
|
|
mkdir -p $directory
|
|
cd $directory
|
|
}
|
|
|
|
proc fullpath(file) {
|
|
if ! (test --file $(pwd)/$file) {
|
|
echo "File $file not in directory $(pwd)"
|
|
} else {
|
|
echo "$(pwd)/$file"
|
|
}
|
|
}
|
|
|
|
proc _ls(@argv) {
|
|
const lsArgs = %('-hF' '--group-directories-first' '--time-style=+%Y-%m-%d %H:%M' '--quoting-style=literal' '--color')
|
|
/usr/bin/ls @lsArgs @argv
|
|
}
|
|
|
|
proc _git_ps1() {
|
|
var m = 0
|
|
var d = 0
|
|
var a = 0
|
|
if ! (git status --porcelain 2>/dev/null 1>/dev/null) {
|
|
#echo "not in a git directory"
|
|
echo ""
|
|
} else {
|
|
#echo "in a git directory"
|
|
echo -n "| "
|
|
echo -ne r'\033[0;32m'
|
|
echo -n "$(git branch --show-current)"
|
|
echo -ne r'\033[0m '
|
|
for x in $(git status --porcelain) {
|
|
var nx = "${x:0:1}"
|
|
if (nx === "M") {
|
|
setvar m += 1
|
|
} elif (nx === "D") {
|
|
setvar d += 1
|
|
} elif (nx === "?") {
|
|
setvar a += 1
|
|
}
|
|
}
|
|
#echo "| !$[m + d] ?$a"
|
|
if (m > 0 or d > 0) { #jank because i can't add them together to get a new variable(???)
|
|
echo -ne r'\033[0;33m'
|
|
echo -n "!$[m + d] "
|
|
echo -ne r'\033[0m'
|
|
}
|
|
if (a > 0) {
|
|
echo -ne r'\033[0;36m'
|
|
echo -n "?$a "
|
|
echo -ne r'\033[0m'
|
|
}
|
|
}
|
|
}
|
|
|
|
#proc errCode() {
|
|
# var tmp = "$?"
|
|
# if (tmp === "0") {
|
|
# #totally 100% genuine do shit
|
|
# echo -n "[$tmp]"
|
|
# } else {
|
|
# echo -ne r'\033[0;31m'
|
|
# echo -n "[$tmp]"
|
|
# echo -ne r'\033[0m'
|
|
# }
|
|
#}
|
|
|
|
proc echoDate() {
|
|
echo -ne r'\033[0;31m'
|
|
echo -n "$(date +%I:%M:%S%P)"
|
|
echo -ne r'\033[0m |'
|
|
}
|
|
|
|
shopt -u oil:all #HAHAHAHAHA THAT WORKS
|
|
shopt -s eval_unsafe_arith
|
|
|
|
alias ls='_ls'
|
|
alias cd='z'
|
|
|
|
#Prompt
|
|
#const PS1 = $'\n| \[\033[0;31m\]\w\033[0m | \033[0;34m\u\033[0m\n\_$ '
|
|
#var PS1 = r'\n| \[\033[0;31m\]\w\[\033[00m\] | \[\033[0;34m\]\u\[\033[00m\] $(_git_ps1) \n\\\_\$ '
|
|
#TODO: do something with right prompt
|
|
var PS1 = r'\n$(printf "%*s\r%s " "$(($(tput cols)+11 ))" "$(echoDate)" "| \[\033[0;31m\]\w\[\033[00m\] | \[\033[0;34m\]\u\[\033[00m\] $(_git_ps1) ") \n\\\_\$ '
|
|
|
|
eval "$(zoxide init posix --hook prompt)"
|
|
#source /home/ruthenic/bash-completion/bash_completion
|