1
0

fixed zsh config nonsense

This commit is contained in:
Emma Tebibyte 2023-11-19 14:48:04 -07:00
parent a990f86247
commit f055bfbedc
Signed by: emma
GPG Key ID: 6D661C738815E7DD
5 changed files with 101 additions and 120 deletions

View File

@ -24,5 +24,7 @@ do
ln -sf "$PWD/$item" "$XDG_CONFIG_HOME/$inst_path" ln -sf "$PWD/$item" "$XDG_CONFIG_HOME/$inst_path"
done done
ln -sf "$PWD/$MACHINE/zshrc" "$HOME/.zshrc" ln -sf "$PWD/$MACHINE/functions" "$HOME/.functions"
ln -sf "$PWD/$MACHINE/profile" "$HOME/.profile" ln -sf "$PWD/$MACHINE/profile" "$HOME/.profile"
ln -sf "$PWD/$MACHINE/zprofile" "$HOME/.zprofile"
ln -sf "$PWD/$MACHINE/zshrc" "$HOME/.zshrc"

75
noire-carnation/functions Executable file
View File

@ -0,0 +1,75 @@
#!/bin/sh
bmv() {
if test -z "$1"; then
printf "Usage: %s [files pattern]...\n" "$0" 1>&2
return 64 # sysexits.h(3) EX_USAGE
fi
while test -n "$2"; do
for file in $1; do
mv "$file" "$(printf "%s" "$file" | sed "s/\$2//g")"
done
shift 2
done
}
ix() {
curl -F 'f:1=<-' ix.io
}
myip() {
curl icanhazip.com
}
paclean() {
for package in `pacman -Qtq`; do
pacman -Qi "$package"
printf "Uninstall? [y/N] "
read resp
# TODO: Add undo
if [ "$resp" != "y" ] && [ "$resp" != "Y" ]; then
printf "Skipped %s.\n\n" "$package" 1>&2
else
printf "Queued %s for uninstall.\n\n" "$package" 1>&2
packages="$packages$package "
fi
done
su -c "pacman -Rns $packages"
}
sc() {
if test -z "$1"; then
printf "Usage: %s URI...\n" "$0" 1>&2
return 64 # sysexits.h(3) EX_USAGE
fi
while "$1"; do
scdl --original-name --debug -l "$1" >> log 2>&1
done
}
up() { # updates everything on the system
command -v apk >/dev/null && su -c 'apk update'
command -v cargo-install-update >/dev/null && cargo install-update --all --git
command -v kiss >/dev/null && su -c 'kiss u' && su -c 'kiss U'
command -v nvim >/dev/null && nvim +PlugUpdate -c x -c x
if command -v paru >/dev/null; then paru
elif command -v pacman >/dev/null; then su -c 'pacman -Syyu'; fi
CWD="$PWD"
command -v git >/dev/null && \
for dir in $HOME/.local/src/git/*/*/*/
do
printf '%s\n' "$dir"
cd "$dir"
git pull --all
done
cd "$CWD"
}

View File

@ -43,74 +43,6 @@ GTK_IM_MODULE=ibus; export GTK_IM_MODULE
QT_IM_MODULE=ibus; export QT_IM_MODULE QT_IM_MODULE=ibus; export QT_IM_MODULE
XMODIFIERS=@im=ibus; export XMODIFIERS XMODIFIERS=@im=ibus; export XMODIFIERS
# functions
bmv() {
if test -z "$1"; then
printf "Usage: %s [files pattern]...\n" "$0" 1>&2
return 64 # sysexits.h(3) EX_USAGE
fi
while test -n "$2"; do
for file in $1; do
mv "$file" "$(printf "%s" "$file" | sed "s/\$2//g")"
done
shift 2
done
}
ix() {
curl -F 'f:1=<-' ix.io
}
myip() {
curl icanhazip.com
}
paclean() {
for package in `pacman -Qtq`; do
pacman -Qi "$package"
printf "Uninstall? [y/N] "
read resp
# TODO: Add undo
if [ "$resp" != "y" ] && [ "$resp" != "Y" ]; then
printf "Skipped %s.\n\n" "$package" 1>&2
else
printf "Queued %s for uninstall.\n\n" "$package" 1>&2
packages="$packages$package "
fi
done
su -c "pacman -Rns $packages"
}
sc() {
if test -z "$1"; then
printf "Usage: %s URI...\n" "$0" 1>&2
return 64 # sysexits.h(3) EX_USAGE
fi
while "$1"; do
scdl --original-name --debug -l "$1" >> log 2>&1
done
}
yt() {
if test -z "$1"; then
printf "Usage: %s URI...\n" "$0" 1>&2
return 64 # sysexits.h(3) EX_USAGE
fi
while "$1"; do
yt-dlp -vx --split-chapters -o \
"chapter:%(fulltitle)s - %(section_number)s %(section_title)s.%(ext)s" \
"$1" --audio-quality 0 >> log 2>&1
shift
done
}
# aliases # aliases
alias weather="curl 'wttr.in/?0'" alias weather="curl 'wttr.in/?0'"
alias vi="busybox vi" alias vi="busybox vi"
@ -121,54 +53,4 @@ case "$SHELL" in
set -o vi set -o vi
PS1='$ ' PS1='$ '
;; ;;
*/zsh )
HISTFILE="$XDG_DATA_HOME/zsh/histfile"
HISTSIZE=999999999
SAVEHIST="$HISTSIZE"
unsetopt autocd
bindkey -v
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit -u -d "$XDG_CACHE_HOME/zsh/zcompdump"
setopt rmstarsilent
# Key (zshmisc(1)):
#
# '%F{$color}$x%f': Change foreground color of $x to $color
# '%B$x%b': Make $x bold
# '%n': $USER
# '%M': $HOST
# '%1~': $PWD, but shows '~' if at $HOME
# '%(?.#.%?)':
# '%n(x.true.false)' evaluates ternary expression for condition x, where n
# is an integer, by default '0':
# '?': If the last commands exit status was 0, true
# '#': Prints literal '#' to the prompt
# '[%?]': Prints the last exit status with literal brackets surrounding it
ERR='[%f%F{green}%?%f%F{blue}]%f'
ERR_LINE="%(?.#.$ERR)"
LINE1='%F{blue}╭%f %B%F{blue}%n%f@%F{magenta}%M%f%b'
LINE2='%F{blue}│%f %F{green}%B%0~%b%f'
LINE3="%F{blue}╰─$ERR_LINE%f "
PS1="$(printf "%s\n%s\n%s" "$LINE1" "$LINE2" "$LINE3")"; export PS1
plugindir="/usr/share/zsh/plugins"
for plugin in \
"$plugindir/zsh-autosuggestions/zsh-autosuggestions.zsh" \
"$plugindir/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" \
"$plugindir/zsh-history-substring-search/zsh-history-substring-search.zsh"
do
source "$plugin"
done
bindkey -a 'k' history-substring-search-up
bindkey -a 'j' history-substring-search-down
alias which="$HOME/.local/bin/which"
;;
esac esac

1
noire-carnation/zprofile Normal file
View File

@ -0,0 +1 @@
test -e "$HOME/.profile" && source "$HOME/.profile"

View File

@ -1 +1,22 @@
source "$HOME/.profile" test -e "$HOME/.functions" && source "$HOME/.functions"
unsetopt autocd
bindkey -v
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit -u -d "$XDG_CACHE_HOME/zsh/zcompdump"
setopt rmstarsilent
plugindir="/usr/share/zsh/plugins"
for plugin in \
"$plugindir/zsh-autosuggestions/zsh-autosuggestions.zsh" \
"$plugindir/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" \
"$plugindir/zsh-history-substring-search/zsh-history-substring-search.zsh"
do
source "$plugin"
done
bindkey -a 'k' history-substring-search-up
bindkey -a 'j' history-substring-search-down
alias which="$HOME/.local/bin/which"