some changes

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

86
.zshrc
View file

@ -71,7 +71,6 @@ check_root() {
_sudo="sudo" _sudo="sudo"
else else
echo_error "No sudo found and you're not root! Can't install packages." echo_error "No sudo found and you're not root! Can't install packages."
return 1
fi fi
else else
echo_info "Root access confirmed." echo_info "Root access confirmed."
@ -85,20 +84,8 @@ autoload -Uz compinit && compinit
bindkey -e bindkey -e
# # Define custom word style that treats special characters as word boundaries # # Define custom word style that treats special characters as word boundaries
# autoload -U select-word-style autoload -Uz select-word-style
# select-word-style fish select-word-style bash
# # 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='*?_.[]~=&;!#$%^(){}<>'
setopt appendhistory setopt appendhistory
setopt sharehistory setopt sharehistory
@ -107,8 +94,7 @@ setopt hist_ignore_all_dups
setopt hist_save_no_dups setopt hist_save_no_dups
setopt hist_ignore_dups setopt hist_ignore_dups
setopt hist_find_no_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? # Huge history. Doesn't appear to slow things down, so why not?
HISTSIZE=500000 HISTSIZE=500000
HISTFILESIZE=100000 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/amro.toml')"
# eval "$(oh-my-posh init zsh --config '~/.zsh/themes/atomicBit.toml')" # eval "$(oh-my-posh init zsh --config '~/.zsh/themes/atomicBit.toml')"
else 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 fi
if command_exists zoxide; then if command_exists zoxide; then
@ -264,17 +250,17 @@ _alias() {
command tmux list-sessions >/dev/null 2>&1 command tmux list-sessions >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if command_exists notify-send; then if command_exists notify-send; then
notify-send "TMUX" "$tmux_y" notify-send "TMUX" "${tmux_y}"
sleep 0.5 sleep 0.5
tmux attach tmux attach
else else
echo_info "$tmux_y" echo_info "${tmux_y}"
sleep 0.5 sleep 0.5
tmux attach tmux attach
fi fi
else else
if command_exists notify-send; then if command_exists notify-send; then
notify-send "TMUX" "$tmux_n" notify-send "TMUX" "${tmux_n}"
sleep 0.5 sleep 0.5
tmux tmux
else else
@ -287,21 +273,15 @@ _alias() {
alias ts="tmux source $HOME/.tmux.conf" alias ts="tmux source $HOME/.tmux.conf"
fi 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) >─────────────────────────────────────────────────────────────── # ─< t stands for trash(-cli) >───────────────────────────────────────────────────────────────
if command_exists trash; then if command_exists trash; then
alias rm="trash" alias rm="trash"
alias t="trash" alias t="trash"
alias tlist="trash -list"
elif command_exists trash-cli; then elif command_exists trash-cli; then
alias rm="trash-cli" alias rm="trash-cli"
alias t="trash-cli" alias t="trash-cli"
alias tlist="trash-list"
else else
echo_error "-- You do not have trash or trash-cli installed! Your 'rm' will be permanent! --" echo_error "-- You do not have trash or trash-cli installed! Your 'rm' will be permanent! --"
fi fi
@ -310,11 +290,9 @@ _alias() {
if command_exists batcat; then if command_exists batcat; then
alias cat="batcat --color=always -p --paging=never" alias cat="batcat --color=always -p --paging=never"
alias less="batcat --paging always --color=always" alias less="batcat --paging always --color=always"
# alias gd="batcat --diff"
elif command_exists bat; then elif command_exists bat; then
alias cat="bat --color=always -p" alias cat="bat --color=always -p"
alias less="bat --paging always --color=always" alias less="bat --paging always --color=always"
# alias gd="bat --diff"
fi fi
# ─< wireguard alias >──────────────────────────────────────────────────────────────────── # ─< wireguard alias >────────────────────────────────────────────────────────────────────
@ -343,6 +321,8 @@ _alias() {
# ─< d stands for docker >────────────────────────────────────────────────────────────────── # ─< d stands for docker >──────────────────────────────────────────────────────────────────
if command_exists docker; then 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 up="docker compose up"
alias down="docker compose down" alias down="docker compose down"
alias pull="docker compose pull" alias pull="docker compose pull"
@ -448,7 +428,6 @@ _alias() {
fi fi
fi fi
alias inst_lazydocker="curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash"
} }
_coding_() { _coding_() {
@ -457,10 +436,7 @@ _coding_() {
alias h='hugo' alias h='hugo'
alias hs='hugo server -D --noHTTPCache --disableFastRender --bind "$(get_ip)"' alias hs='hugo server -D --noHTTPCache --disableFastRender --bind "$(get_ip)"'
fi fi
# ─< c stands for bin/cake >──────────────────────────────────────────────────────────────
# alias cake='bin/cake'
# alias c='cake'
# alias cs='c server -p 1313'
# ─< VSCodium >───────────────────────────────────────────────────────────────────────────── # ─< VSCodium >─────────────────────────────────────────────────────────────────────────────
if command_exists codium; then if command_exists codium; then
alias code="codium" alias code="codium"
@ -470,11 +446,11 @@ _coding_() {
# ─< neovide, the best frontend for any neovim-config >─────────────────────────────────── # ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
if command_exists nvim; then if command_exists nvim; then
if command_exists neovide; then if command_exists neovide; then
if [ -n "$TMUX" ]; then # if [ -n "$TMUX" ]; then
alias nvim="command nvim" # alias nvim="command nvim"
else # else
alias nvim="neovide --fork" alias nvim="neovide --fork"
fi # fi
fi 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 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 # Check if npm is available, then create the alias
if command_exists npm; then if command_exists npm; then
npmrun() { npmrun() {
@ -533,7 +500,7 @@ get_packager() {
. /etc/os-release . /etc/os-release
case "$ID" in case "$ID" in
# Debian-based # Debian-based
ubuntu | debian | pop | kali | zorin) ubuntu | debian | pop | kali | zorin | rhinoh)
if command_exists nala; then if command_exists nala; then
alias search="nala search" alias search="nala search"
alias install="$_sudo nala install --assume-yes" alias install="$_sudo nala install --assume-yes"
@ -593,24 +560,9 @@ get_packager() {
esac 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() { _environment() {
if command_exists nvim; then if command_exists nvim; then
export EDITOR="nvim" export EDITOR="$(which nvim)"
fi
if command_exists ranger; then
export RANGER_LOAD_DEFAULT_RC="FALSE"
fi fi
# ─< paths >────────────────────────────────────────────────────────────────────────────── # ─< paths >──────────────────────────────────────────────────────────────────────────────
@ -624,7 +576,7 @@ _environment() {
[ -d "$HOME/go/bin" ] && export PATH="$HOME/go/bin:$PATH" [ -d "$HOME/go/bin" ] && export PATH="$HOME/go/bin:$PATH"
[ -d "$HOME/.cargo/bin" ] && export PATH="$HOME/.cargo/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 # bun completions
[ -s "$HOME/.bun/_bun" ] && . "$HOME/.bun/_bun" [ -s "$HOME/.bun/_bun" ] && . "$HOME/.bun/_bun"