addet yazi 'y' function

This commit is contained in:
pik4li 2024-12-25 10:07:18 +01:00
parent 2ef1ba0f33
commit 24ec2d6925

54
.zshrc
View file

@ -119,7 +119,7 @@ HISTDUP=erase
# Completion styling
zstyle :compinstall filename "$HOME/.zshrc"
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
@ -131,7 +131,7 @@ if command_exists fzf; then
source <(fzf --zsh)
fi
_init (){
_init() {
if command_exists oh-my-posh; then
# eval "$(oh-my-posh init zsh --config 'https://git.k4li.de/dotfiles/oh-my-posh/raw/branch/main/amro.toml')"
# eval "$(oh-my-posh init zsh --config '~/.zsh/themes/sim-web.toml')"
@ -146,7 +146,7 @@ _init (){
eval "$(zoxide init zsh --cmd cd)"
fi
# ─< environment variables for zsh >──────────────────────────────────────────────────────
# ─< environment variables for zsh >──────────────────────────────────────────────────────
local zplug="$HOME/.zsh/plugins"
local zFzfCd="$zplug/custom/zsh-interactive-cd.plugin.zsh"
@ -170,11 +170,11 @@ _init (){
"$zAgentManagement"
"$zCommandNotFound"
"$zExtraction"
)
)
DEBUG_PLUG=""
DEBUG_PLUG=""
# ─< init plugis >────────────────────────────────────────────────────────────────────────
# ─< init plugis >────────────────────────────────────────────────────────────────────────
for zPlug in "${_pluginlist[@]}"; do
[[ -f "$zPlug" ]] &&
. $zPlug
@ -183,12 +183,12 @@ DEBUG_PLUG=""
done
}
_alias(){
_alias() {
alias please="sudo"
# ─< easier dir up >────────────────────────────────────────────────────────────────────────
alias ..="cd .."
# ─< weather >──────────────────────────────────────────────────────────────────────────────
# ─< weather >──────────────────────────────────────────────────────────────────────────────
alias www="curl wttr.in/Ulm"
# ─< colored ip >───────────────────────────────────────────────────────────────────
@ -214,10 +214,18 @@ _alias(){
alias lazygit="$HOME/go/bin/lazygit" &&
alias lg="lazygit"
# ─< cli explorer >───────────────────────────────────────────────────────────────────────
# ─< cli explorer >───────────────────────────────────────────────────────────────────────
if command_exists yazi; then
echo_info "yazi is the explorer of choise"
alias lf="yazi || ya pack -i"
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
elif command_exists ranger; then
echo_info "ranger is the explorer of choise"
alias lf="ranger"
@ -279,7 +287,7 @@ _alias(){
alias ts="tmux source $HOME/.tmux.conf"
fi
# ─< v stands vor virtual-machine (kvm) >─────────────────────────────────────────────────
# ─< v stands vor virtual-machine (kvm) >─────────────────────────────────────────────────
if command_exists virsh; then
alias vm="virsh"
alias vms="virsh start"
@ -287,7 +295,7 @@ _alias(){
alias vmsd="virsh shutdown"
fi
# ─< t stands for trash(-cli) >───────────────────────────────────────────────────────────────
# ─< t stands for trash(-cli) >───────────────────────────────────────────────────────────────
if command_exists trash; then
alias rm="trash"
alias t="trash"
@ -346,7 +354,7 @@ _alias(){
alias dl="docker compose logs -f"
alias dc="docker compose"
alias appupdate="docker compose pull && docker compose up -d --force-recreate"
drweb() {
drweb() {
drweb_help() {
echo "Usage: drweb <server_type> [directory] [port]"
echo " server_type: Type of server to use (nginx or php)"
@ -397,7 +405,7 @@ drweb() {
return 1
;;
esac
}
}
fi
# ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
@ -459,7 +467,7 @@ _coding_() {
export EDITOR="codium"
fi
# ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
# ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
if command_exists nvim; then
if command_exists neovide; then
if [ -n "$TMUX" ]; then
@ -486,7 +494,7 @@ _coding_() {
# Check if npm is available, then create the alias
if command_exists npm; then
npmrun(){
npmrun() {
npmrun_help() {
echo "Usage: npmrun [environment] [optional:port]"
echo " environment: The npm environment you want to run (e.g. dev)"
@ -525,7 +533,7 @@ get_packager() {
. /etc/os-release
case "$ID" in
# Debian-based
ubuntu|debian|pop|kali|zorin)
ubuntu | debian | pop | kali | zorin)
if command_exists nala; then
alias search="nala search"
alias install="$_sudo nala install --assume-yes"
@ -541,7 +549,7 @@ get_packager() {
;;
# Arch-based
arch|manjaro|endevouros|garuda)
arch | manjaro | endevouros | garuda)
if command_exists paru; then
alias search="paru -Ss"
alias install="paru -S --noconfirm"
@ -561,7 +569,7 @@ get_packager() {
;;
# RHEL-based
fedora|centos)
fedora | centos)
alias search="dnf search"
alias install="$_sudo dnf install --yes"
alias update="$_sudo dnf update"
@ -585,7 +593,7 @@ get_packager() {
esac
}
_tools_(){
_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
@ -596,7 +604,7 @@ _tools_(){
fi
}
_environment(){
_environment() {
if command_exists nvim; then
export EDITOR="nvim"
fi
@ -605,7 +613,7 @@ _environment(){
export RANGER_LOAD_DEFAULT_RC="FALSE"
fi
# ─< paths >──────────────────────────────────────────────────────────────────────────────
# ─< paths >──────────────────────────────────────────────────────────────────────────────
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
if [ -e "$HOME/.local/bin/lazydocker" ]; then
@ -625,7 +633,7 @@ _environment(){
[ -d "$HOME/.zsh/plugins/fzf-zsh-plugin/bin" ] && export PATH="$HOME/.zsh/plugins/fzf-zsh-plugin/bin:$PATH"
}
_end(){
_end() {
if command_exists fastfetch; then
clear &&
fastfetch
@ -639,7 +647,7 @@ _end(){
error_log
}
main(){
main() {
get_packager
_init
_environment