⚡ Mainly bash refact
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
export PATH="$PATH:$HOME/.local/share/soar/bin"
|
||||
|
||||
alias vim='vim --servername v'
|
||||
|
||||
crossSession 'm0' "$OLDPWD"
|
||||
cd() {
|
||||
builtin cd "$@" || return $?
|
||||
crossSession 'OLDPWD' "$(pwd)"
|
||||
local -r hook="$BASH_DOTFILES/hooks/oncd"
|
||||
[[ -f "$hook" ]] && source "$hook"
|
||||
if [[ -f "$hook" ]]; then
|
||||
source "$hook"
|
||||
fi
|
||||
}
|
||||
|
||||
alias gitdotfiles='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"'
|
||||
@@ -13,11 +18,22 @@ alias gitdotfiles='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"
|
||||
alias §df='df -Th'
|
||||
|
||||
git(){
|
||||
if [[ -n ${COMP_LINE-} ]]; then # Skip hook logic when bash completion is active
|
||||
command git "$@"
|
||||
return $?
|
||||
fi
|
||||
if [[ -z "$1" ]]; then
|
||||
git-i
|
||||
return $?
|
||||
fi
|
||||
command git "$@"
|
||||
local -r exitcode=$?
|
||||
|
||||
local -r hook="$BASH_DOTFILES/hooks/onpostgit"
|
||||
if [[ -f "$hook" ]]; then
|
||||
source "$hook"
|
||||
fi
|
||||
return $exitcode
|
||||
}
|
||||
alias smerge='/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=sublime_merge --file-forwarding com.sublimemerge.App @@u %u @@'
|
||||
kommit(){
|
||||
@@ -101,6 +117,7 @@ alias npx-qnm='npx -y qnm'
|
||||
alias npx-hint='npx -y hint'
|
||||
alias npx-markdown='npx -y markserv'
|
||||
alias npx-toon='npx -y @toon-format/cli'
|
||||
alias ncu='npx npm-check-updates --interactive --format group --cooldown 7'
|
||||
|
||||
rpg(){
|
||||
rpg-cli "$@"
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
declare -r CROSS_SESSION="$BASH_DOTFILES/toolchains/cross-session/store.sh"
|
||||
[[ -f "$CROSS_SESSION" ]] && \
|
||||
source "$CROSS_SESSION"
|
||||
source "$CROSS_SESSION"
|
||||
|
||||
# Cross session management function
|
||||
crossSession() {
|
||||
if [[ '--help' == "${1:---help}" ]]; then
|
||||
echo 'crossSession [--help]'
|
||||
echo ' Print this help.'
|
||||
echo 'crossSession [--list]'
|
||||
echo ' Lists all cross session variables or print this help.'
|
||||
echo 'crossSession <name> [<value>]'
|
||||
echo ' Sets cross session variable <name> to <value> (or empty for unset).'
|
||||
return 0
|
||||
fi
|
||||
if [[ '--list' == "$1" ]]; then
|
||||
cat "$CROSS_SESSION"
|
||||
return 0
|
||||
fi
|
||||
local name="$1"
|
||||
local value="$2"
|
||||
if [[ '--help' == "${1:---help}" ]]; then
|
||||
echo 'crossSession [--help]'
|
||||
echo ' Print this help.'
|
||||
echo 'crossSession [--list]'
|
||||
echo ' Lists all cross session variables or print this help.'
|
||||
echo 'crossSession <name> [<value>]'
|
||||
echo ' Sets cross session variable <name> to <value> (or empty for unset).'
|
||||
return 0
|
||||
fi
|
||||
if [[ '--list' == "$1" ]]; then
|
||||
cat "$CROSS_SESSION"
|
||||
return 0
|
||||
fi
|
||||
local name="$1"
|
||||
local value="$2"
|
||||
|
||||
# Check if the variable already exists in the file
|
||||
if grep -q "^export $name=" "$CROSS_SESSION"; then
|
||||
if [[ -z "$value" ]]; then
|
||||
# If new value is empty, remove the variable from the file
|
||||
sed -i "/^export $name=/d" "$CROSS_SESSION"
|
||||
else
|
||||
# If it exists, replace the old value with the new value
|
||||
sed -i "s|^export $name=.*|export $name=\"$value\"|" "$CROSS_SESSION"
|
||||
fi
|
||||
else
|
||||
if [[ -n "$value" ]]; then
|
||||
# If it doesn't exist and new value is not empty, append the new variable to the file
|
||||
echo "export $name='$value'" >> "$CROSS_SESSION"
|
||||
fi
|
||||
fi
|
||||
# Check if the variable already exists in the file
|
||||
if grep -q "^export $name=" "$CROSS_SESSION"; then
|
||||
if [[ -z "$value" ]]; then
|
||||
# If new value is empty, remove the variable from the file
|
||||
sed -i "/^export $name=/d" "$CROSS_SESSION"
|
||||
else
|
||||
# If it exists, replace the old value with the new value
|
||||
sed -i "s|^export $name=.*|export $name=\"$value\"|" "$CROSS_SESSION"
|
||||
fi
|
||||
else
|
||||
if [[ -n "$value" ]]; then
|
||||
# If it doesn't exist and new value is not empty, append the new variable to the file
|
||||
echo "export $name='$value'" >> "$CROSS_SESSION"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
export OLDPWD="/home/jaandrle/Vzdálené/GitHub/facilitator-network-cell"
|
||||
export mwdcp='/home/jaandrle/Vzdálené/GitHub/dcp-fe-container-certifedpassport'
|
||||
export mdde='/home/jaandrle/Vzdálené/GitHub/deka-dom-el'
|
||||
export mwdgf='/home/jaandrle/Vzdálené/GitHub/DGF-Certified-Supervisory-Academy'
|
||||
export mwdgfapi='/home/jaandrle/Vzdálené/GitHub/DGF-Certified-Supervisory-Academy-API'
|
||||
export mkde='/home/jaandrle/Dokumenty/Projekty/kde-překlady'
|
||||
export mwnetcell='/home/jaandrle/Vzdálené/GitHub/facilitator-network-cell'
|
||||
export OLDPWD="/home/jaandrle/Vzdálené/GitHub/Facilitator-App-Native"
|
||||
export mb='/home/jaandrle/.bash'
|
||||
export m0="/home/jaandrle/Vzdálené/GitHub/Facilitator-App-Native"
|
||||
export mg='/home/jaandrle/Vzdálené/GitHub'
|
||||
export mp='/home/jaandrle/Dokumenty/Projekty'
|
||||
export mm='/home/jaandrle/Vzdálené/GitHub/Facilitator-App-Native'
|
||||
export mmbs='/home/jaandrle/.config/bsrc/my/home/jaandrle/Vzdálené/GitHub/Facilitator-App-Native/bs'
|
||||
|
||||
@@ -67,11 +67,6 @@ HELP
|
||||
alias cd-kdialog='cd "$(kdialog --getexistingdirectory --title "Vyberte složku" 2>/dev/null)"'
|
||||
alias fd='fdfind'
|
||||
|
||||
# vim-like aliases?
|
||||
alias dw='rm'
|
||||
alias cw='mv'
|
||||
alias g='fdfind'
|
||||
|
||||
# yanked files
|
||||
export YANKED=()
|
||||
p() {
|
||||
@@ -103,6 +98,3 @@ y() {
|
||||
[[ $(command -v _complete_alias) ]] || source "$BASH_DOTFILES/shell/complete-alias/complete_alias"
|
||||
source <(fdfind --gen-completions)
|
||||
complete -F _complete_alias fd
|
||||
complete -F _complete_alias dw
|
||||
complete -F _complete_alias cw
|
||||
complete -F _complete_alias g
|
||||
|
||||
Reference in New Issue
Block a user