addet yazi 'y' function
This commit is contained in:
parent
2ef1ba0f33
commit
24ec2d6925
1 changed files with 172 additions and 164 deletions
54
.zshrc
54
.zshrc
|
@ -119,7 +119,7 @@ HISTDUP=erase
|
||||||
# Completion styling
|
# Completion styling
|
||||||
zstyle :compinstall filename "$HOME/.zshrc"
|
zstyle :compinstall filename "$HOME/.zshrc"
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
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 ':completion:*' menu no
|
||||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
||||||
zstyle ':fzf-tab:complete:__zoxide_z:*' 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)
|
source <(fzf --zsh)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_init (){
|
_init() {
|
||||||
if command_exists oh-my-posh; then
|
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 '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')"
|
# eval "$(oh-my-posh init zsh --config '~/.zsh/themes/sim-web.toml')"
|
||||||
|
@ -146,7 +146,7 @@ _init (){
|
||||||
eval "$(zoxide init zsh --cmd cd)"
|
eval "$(zoxide init zsh --cmd cd)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ─< environment variables for zsh >──────────────────────────────────────────────────────
|
# ─< environment variables for zsh >──────────────────────────────────────────────────────
|
||||||
local zplug="$HOME/.zsh/plugins"
|
local zplug="$HOME/.zsh/plugins"
|
||||||
|
|
||||||
local zFzfCd="$zplug/custom/zsh-interactive-cd.plugin.zsh"
|
local zFzfCd="$zplug/custom/zsh-interactive-cd.plugin.zsh"
|
||||||
|
@ -170,11 +170,11 @@ _init (){
|
||||||
"$zAgentManagement"
|
"$zAgentManagement"
|
||||||
"$zCommandNotFound"
|
"$zCommandNotFound"
|
||||||
"$zExtraction"
|
"$zExtraction"
|
||||||
)
|
)
|
||||||
|
|
||||||
DEBUG_PLUG=""
|
DEBUG_PLUG=""
|
||||||
|
|
||||||
# ─< init plugis >────────────────────────────────────────────────────────────────────────
|
# ─< init plugis >────────────────────────────────────────────────────────────────────────
|
||||||
for zPlug in "${_pluginlist[@]}"; do
|
for zPlug in "${_pluginlist[@]}"; do
|
||||||
[[ -f "$zPlug" ]] &&
|
[[ -f "$zPlug" ]] &&
|
||||||
. $zPlug
|
. $zPlug
|
||||||
|
@ -183,12 +183,12 @@ DEBUG_PLUG=""
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
_alias(){
|
_alias() {
|
||||||
alias please="sudo"
|
alias please="sudo"
|
||||||
|
|
||||||
# ─< easier dir up >────────────────────────────────────────────────────────────────────────
|
# ─< easier dir up >────────────────────────────────────────────────────────────────────────
|
||||||
alias ..="cd .."
|
alias ..="cd .."
|
||||||
# ─< weather >──────────────────────────────────────────────────────────────────────────────
|
# ─< weather >──────────────────────────────────────────────────────────────────────────────
|
||||||
alias www="curl wttr.in/Ulm"
|
alias www="curl wttr.in/Ulm"
|
||||||
|
|
||||||
# ─< colored ip >───────────────────────────────────────────────────────────────────
|
# ─< colored ip >───────────────────────────────────────────────────────────────────
|
||||||
|
@ -214,10 +214,18 @@ _alias(){
|
||||||
alias lazygit="$HOME/go/bin/lazygit" &&
|
alias lazygit="$HOME/go/bin/lazygit" &&
|
||||||
alias lg="lazygit"
|
alias lg="lazygit"
|
||||||
|
|
||||||
# ─< cli explorer >───────────────────────────────────────────────────────────────────────
|
# ─< cli explorer >───────────────────────────────────────────────────────────────────────
|
||||||
if command_exists yazi; then
|
if command_exists yazi; then
|
||||||
echo_info "yazi is the explorer of choise"
|
echo_info "yazi is the explorer of choise"
|
||||||
alias lf="yazi || ya pack -i"
|
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
|
elif command_exists ranger; then
|
||||||
echo_info "ranger is the explorer of choise"
|
echo_info "ranger is the explorer of choise"
|
||||||
alias lf="ranger"
|
alias lf="ranger"
|
||||||
|
@ -279,7 +287,7 @@ _alias(){
|
||||||
alias ts="tmux source $HOME/.tmux.conf"
|
alias ts="tmux source $HOME/.tmux.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ─< v stands vor virtual-machine (kvm) >─────────────────────────────────────────────────
|
# ─< v stands vor virtual-machine (kvm) >─────────────────────────────────────────────────
|
||||||
if command_exists virsh; then
|
if command_exists virsh; then
|
||||||
alias vm="virsh"
|
alias vm="virsh"
|
||||||
alias vms="virsh start"
|
alias vms="virsh start"
|
||||||
|
@ -287,7 +295,7 @@ _alias(){
|
||||||
alias vmsd="virsh shutdown"
|
alias vmsd="virsh shutdown"
|
||||||
fi
|
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"
|
||||||
|
@ -346,7 +354,7 @@ _alias(){
|
||||||
alias dl="docker compose logs -f"
|
alias dl="docker compose logs -f"
|
||||||
alias dc="docker compose"
|
alias dc="docker compose"
|
||||||
alias appupdate="docker compose pull && docker compose up -d --force-recreate"
|
alias appupdate="docker compose pull && docker compose up -d --force-recreate"
|
||||||
drweb() {
|
drweb() {
|
||||||
drweb_help() {
|
drweb_help() {
|
||||||
echo "Usage: drweb <server_type> [directory] [port]"
|
echo "Usage: drweb <server_type> [directory] [port]"
|
||||||
echo " server_type: Type of server to use (nginx or php)"
|
echo " server_type: Type of server to use (nginx or php)"
|
||||||
|
@ -397,7 +405,7 @@ drweb() {
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
|
# ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
|
||||||
|
@ -459,7 +467,7 @@ _coding_() {
|
||||||
export EDITOR="codium"
|
export EDITOR="codium"
|
||||||
fi
|
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 nvim; then
|
||||||
if command_exists neovide; then
|
if command_exists neovide; then
|
||||||
if [ -n "$TMUX" ]; then
|
if [ -n "$TMUX" ]; then
|
||||||
|
@ -486,7 +494,7 @@ _coding_() {
|
||||||
|
|
||||||
# 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() {
|
||||||
npmrun_help() {
|
npmrun_help() {
|
||||||
echo "Usage: npmrun [environment] [optional:port]"
|
echo "Usage: npmrun [environment] [optional:port]"
|
||||||
echo " environment: The npm environment you want to run (e.g. dev)"
|
echo " environment: The npm environment you want to run (e.g. dev)"
|
||||||
|
@ -525,7 +533,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)
|
||||||
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"
|
||||||
|
@ -541,7 +549,7 @@ get_packager() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Arch-based
|
# Arch-based
|
||||||
arch|manjaro|endevouros|garuda)
|
arch | manjaro | endevouros | garuda)
|
||||||
if command_exists paru; then
|
if command_exists paru; then
|
||||||
alias search="paru -Ss"
|
alias search="paru -Ss"
|
||||||
alias install="paru -S --noconfirm"
|
alias install="paru -S --noconfirm"
|
||||||
|
@ -561,7 +569,7 @@ get_packager() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# RHEL-based
|
# RHEL-based
|
||||||
fedora|centos)
|
fedora | centos)
|
||||||
alias search="dnf search"
|
alias search="dnf search"
|
||||||
alias install="$_sudo dnf install --yes"
|
alias install="$_sudo dnf install --yes"
|
||||||
alias update="$_sudo dnf update"
|
alias update="$_sudo dnf update"
|
||||||
|
@ -585,7 +593,7 @@ get_packager() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_tools_(){
|
_tools_() {
|
||||||
if ! command_exists has; then
|
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)
|
$(git clone https://github.com/kdabir/has.git /tmp/has && cd /tmp/has && sudo make install && rm -rf /tmp/has)
|
||||||
else
|
else
|
||||||
|
@ -596,7 +604,7 @@ _tools_(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_environment(){
|
_environment() {
|
||||||
if command_exists nvim; then
|
if command_exists nvim; then
|
||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
fi
|
fi
|
||||||
|
@ -605,7 +613,7 @@ _environment(){
|
||||||
export RANGER_LOAD_DEFAULT_RC="FALSE"
|
export RANGER_LOAD_DEFAULT_RC="FALSE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ─< paths >──────────────────────────────────────────────────────────────────────────────
|
# ─< paths >──────────────────────────────────────────────────────────────────────────────
|
||||||
if [ -d "$HOME/.local/bin" ]; then
|
if [ -d "$HOME/.local/bin" ]; then
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
if [ -e "$HOME/.local/bin/lazydocker" ]; then
|
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"
|
[ -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
|
if command_exists fastfetch; then
|
||||||
clear &&
|
clear &&
|
||||||
fastfetch
|
fastfetch
|
||||||
|
@ -639,7 +647,7 @@ _end(){
|
||||||
error_log
|
error_log
|
||||||
}
|
}
|
||||||
|
|
||||||
main(){
|
main() {
|
||||||
get_packager
|
get_packager
|
||||||
_init
|
_init
|
||||||
_environment
|
_environment
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue