some changes

This commit is contained in:
pik4li 2024-12-25 23:39:36 +01:00
parent 00892ae88c
commit df17651a50

88
.zshrc
View file

@ -71,7 +71,6 @@ check_root() {
_sudo="sudo"
else
echo_error "No sudo found and you're not root! Can't install packages."
return 1
fi
else
echo_info "Root access confirmed."
@ -85,20 +84,8 @@ autoload -Uz compinit && compinit
bindkey -e
# # Define custom word style that treats special characters as word boundaries
# autoload -U select-word-style
# select-word-style fish
# # Use Alt + Backspace to delete the previous word
# bindkey '^[^?' backward-kill-word
# # Use Alt + Left Arrow to move to the previous word
# bindkey '^[[1;3D' backward-word
# # Use Alt + Right Arrow to move to the next word
# bindkey '^[[1;3C' forward-word
# # Define additional word characters to split on, excluding '/'
# WORDCHARS='*?_.[]~=&;!#$%^(){}<>'
autoload -Uz select-word-style
select-word-style bash
setopt appendhistory
setopt sharehistory
@ -107,8 +94,7 @@ setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
autoload -Uz select-word-style
select-word-style shell
# Huge history. Doesn't appear to slow things down, so why not?
HISTSIZE=500000
HISTFILESIZE=100000
@ -138,7 +124,7 @@ _init() {
eval "$(oh-my-posh init zsh --config '~/.zsh/themes/amro.toml')"
# eval "$(oh-my-posh init zsh --config '~/.zsh/themes/atomicBit.toml')"
else
curl -s https://ohmyposh.dev/install.sh | sudo bash --norc -s -- -d /usr/bin/
curl -s https://ohmyposh.dev/install.sh | $_sudo bash --norc -s -- -d /usr/bin/
fi
if command_exists zoxide; then
@ -264,17 +250,17 @@ _alias() {
command tmux list-sessions >/dev/null 2>&1
if [ $? -eq 0 ]; then
if command_exists notify-send; then
notify-send "TMUX" "$tmux_y"
notify-send "TMUX" "${tmux_y}"
sleep 0.5
tmux attach
else
echo_info "$tmux_y"
echo_info "${tmux_y}"
sleep 0.5
tmux attach
fi
else
if command_exists notify-send; then
notify-send "TMUX" "$tmux_n"
notify-send "TMUX" "${tmux_n}"
sleep 0.5
tmux
else
@ -287,21 +273,15 @@ _alias() {
alias ts="tmux source $HOME/.tmux.conf"
fi
# ─< v stands vor virtual-machine (kvm) >─────────────────────────────────────────────────
if command_exists virsh; then
alias vm="virsh"
alias vms="virsh start"
alias vml="virsh list --all"
alias vmsd="virsh shutdown"
fi
# ─< t stands for trash(-cli) >───────────────────────────────────────────────────────────────
if command_exists trash; then
alias rm="trash"
alias t="trash"
alias tlist="trash -list"
elif command_exists trash-cli; then
alias rm="trash-cli"
alias t="trash-cli"
alias tlist="trash-list"
else
echo_error "-- You do not have trash or trash-cli installed! Your 'rm' will be permanent! --"
fi
@ -310,11 +290,9 @@ _alias() {
if command_exists batcat; then
alias cat="batcat --color=always -p --paging=never"
alias less="batcat --paging always --color=always"
# alias gd="batcat --diff"
elif command_exists bat; then
alias cat="bat --color=always -p"
alias less="bat --paging always --color=always"
# alias gd="bat --diff"
fi
# ─< wireguard alias >────────────────────────────────────────────────────────────────────
@ -343,6 +321,8 @@ _alias() {
# ─< d stands for docker >──────────────────────────────────────────────────────────────────
if command_exists docker; then
alias inst_lazydocker="curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash"
alias up="docker compose up"
alias down="docker compose down"
alias pull="docker compose pull"
@ -448,7 +428,6 @@ _alias() {
fi
fi
alias inst_lazydocker="curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash"
}
_coding_() {
@ -457,10 +436,7 @@ _coding_() {
alias h='hugo'
alias hs='hugo server -D --noHTTPCache --disableFastRender --bind "$(get_ip)"'
fi
# ─< c stands for bin/cake >──────────────────────────────────────────────────────────────
# alias cake='bin/cake'
# alias c='cake'
# alias cs='c server -p 1313'
# ─< VSCodium >─────────────────────────────────────────────────────────────────────────────
if command_exists codium; then
alias code="codium"
@ -470,11 +446,11 @@ _coding_() {
# ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
if command_exists nvim; then
if command_exists neovide; then
if [ -n "$TMUX" ]; then
alias nvim="command nvim"
else
alias nvim="neovide --fork"
fi
# if [ -n "$TMUX" ]; then
# alias nvim="command nvim"
# else
alias nvim="neovide --fork"
# fi
fi
fi
@ -483,15 +459,6 @@ _coding_() {
ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1
}
if command_exists composer; then
alias laravel_new="composer create-project laravel/laravel"
fi
# Check if php is available, then create the alias
if command_exists php; then
alias phprun="php artisan serve --host=$(get_ip) --port=8000"
fi
# Check if npm is available, then create the alias
if command_exists npm; then
npmrun() {
@ -533,7 +500,7 @@ get_packager() {
. /etc/os-release
case "$ID" in
# Debian-based
ubuntu | debian | pop | kali | zorin)
ubuntu | debian | pop | kali | zorin | rhinoh)
if command_exists nala; then
alias search="nala search"
alias install="$_sudo nala install --assume-yes"
@ -593,24 +560,9 @@ get_packager() {
esac
}
_tools_() {
if ! command_exists has; then
$(git clone https://github.com/kdabir/has.git /tmp/has && cd /tmp/has && sudo make install && rm -rf /tmp/has)
else
tools() {
local pkgs="bash fish git curl make cmake gcc g++ rg docker composer node npm php jre python3 go cargo"
has $pkgs
}
fi
}
_environment() {
if command_exists nvim; then
export EDITOR="nvim"
fi
if command_exists ranger; then
export RANGER_LOAD_DEFAULT_RC="FALSE"
export EDITOR="$(which nvim)"
fi
# ─< paths >──────────────────────────────────────────────────────────────────────────────
@ -624,7 +576,7 @@ _environment() {
[ -d "$HOME/go/bin" ] && export PATH="$HOME/go/bin:$PATH"
[ -d "$HOME/.cargo/bin" ] && export PATH="$HOME/.cargo/bin:$PATH"
# [ -e "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
[ -e "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
# bun completions
[ -s "$HOME/.bun/_bun" ] && . "$HOME/.bun/_bun"