Disabled default zelli
This commit is contained in:
+5
-11
@@ -1,18 +1,12 @@
|
||||
abbr -a -- cd z
|
||||
abbr -a -- cl clear
|
||||
abbr -a -- tm tmux
|
||||
abbr -a -- docker podman
|
||||
abbr -a -- g git
|
||||
abbr -a -- l ezals
|
||||
abbr -a -- ll 'ezals -TL2'
|
||||
abbr -a -- ls ezals
|
||||
abbr -a -- q exit
|
||||
abbr -a -- v nvim
|
||||
abbr -a --position anywhere --command git -- a add
|
||||
abbr -a --position anywhere --command git -- b branch
|
||||
abbr -a --position anywhere --command git -- c commit
|
||||
abbr -a --position anywhere --command git -- co checkout
|
||||
abbr -a --position anywhere --command git -- d diff
|
||||
abbr -a --position anywhere --command git -- s status
|
||||
abbr -a --position anywhere --command tmux -- r rename
|
||||
abbr -a --position anywhere --command tmux -- rw renamew
|
||||
abbr -a -- kc kubectl
|
||||
abbr -a -- zj zellij
|
||||
abbr -a -- sysc systemctl
|
||||
abbr -a -- syscu systemctl --user
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Path to Oh My Fish install.
|
||||
set -q XDG_DATA_HOME
|
||||
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
|
||||
or set -gx OMF_PATH "$HOME/.local/share/omf"
|
||||
|
||||
# Load Oh My Fish configuration.
|
||||
source $OMF_PATH/init.fish
|
||||
@@ -0,0 +1,100 @@
|
||||
# =============================================================================
|
||||
#
|
||||
# Utility functions for zoxide.
|
||||
#
|
||||
|
||||
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
|
||||
function __zoxide_pwd
|
||||
builtin pwd -L
|
||||
end
|
||||
|
||||
# A copy of fish's internal cd function. This makes it possible to use
|
||||
# `alias cd=z` without causing an infinite loop.
|
||||
if ! builtin functions --query __zoxide_cd_internal
|
||||
string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' <$__fish_data_dir/functions/cd.fish | source
|
||||
end
|
||||
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
function __zoxide_cd
|
||||
if set -q __zoxide_loop
|
||||
builtin echo "zoxide: infinite loop detected"
|
||||
builtin echo "Avoid aliasing `cd` to `z` directly, use `zoxide init --cmd=cd fish` instead"
|
||||
return 1
|
||||
end
|
||||
__zoxide_loop=1 __zoxide_cd_internal $argv
|
||||
end
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Hook configuration for zoxide.
|
||||
#
|
||||
|
||||
# Initialize hook to add new entries to the database.
|
||||
function __zoxide_hook --on-variable PWD
|
||||
test -z "$fish_private_mode"
|
||||
and command zoxide add -- (__zoxide_pwd)
|
||||
end
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||||
#
|
||||
|
||||
# Jump to a directory using only keywords.
|
||||
function __zoxide_z
|
||||
set -l argc (builtin count $argv)
|
||||
if test $argc -eq 0
|
||||
__zoxide_cd $HOME
|
||||
else if test "$argv" = -
|
||||
__zoxide_cd -
|
||||
else if test $argc -eq 1 -a -d $argv[1]
|
||||
__zoxide_cd $argv[1]
|
||||
else if test $argc -eq 2 -a $argv[1] = --
|
||||
__zoxide_cd -- $argv[2]
|
||||
else
|
||||
set -l result (command zoxide query --exclude (__zoxide_pwd) -- $argv)
|
||||
and __zoxide_cd $result
|
||||
end
|
||||
end
|
||||
|
||||
# Completions.
|
||||
function __zoxide_z_complete
|
||||
set -l tokens (builtin commandline --current-process --tokenize)
|
||||
set -l curr_tokens (builtin commandline --cut-at-cursor --current-process --tokenize)
|
||||
|
||||
if test (builtin count $tokens) -le 2 -a (builtin count $curr_tokens) -eq 1
|
||||
# If there are < 2 arguments, use `cd` completions.
|
||||
complete --do-complete "'' "(builtin commandline --cut-at-cursor --current-token) | string match --regex -- '.*/$'
|
||||
else if test (builtin count $tokens) -eq (builtin count $curr_tokens)
|
||||
# If the last argument is empty, use interactive selection.
|
||||
set -l query $tokens[2..-1]
|
||||
set -l result (command zoxide query --exclude (__zoxide_pwd) --interactive -- $query)
|
||||
and __zoxide_cd $result
|
||||
and builtin commandline --function cancel-commandline repaint
|
||||
end
|
||||
end
|
||||
complete --command __zoxide_z --no-files --arguments '(__zoxide_z_complete)'
|
||||
|
||||
# Jump to a directory using interactive search.
|
||||
function __zoxide_zi
|
||||
set -l result (command zoxide query --interactive -- $argv)
|
||||
and __zoxide_cd $result
|
||||
end
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Commands for zoxide. Disable these using --no-cmd.
|
||||
#
|
||||
|
||||
abbr --erase z &>/dev/null
|
||||
alias z=__zoxide_z
|
||||
|
||||
abbr --erase zi &>/dev/null
|
||||
alias zi=__zoxide_zi
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# To initialize zoxide, add this to your configuration (usually
|
||||
# ~/.config/fish/config.fish):
|
||||
#
|
||||
# zoxide init fish | source
|
||||
+34
-16
@@ -2,25 +2,43 @@ set -g fish_greeting "Hi Dadd"
|
||||
|
||||
# set nvim editor
|
||||
set -g EDITOR nvim
|
||||
set -g KUBE_EDITOR nvim
|
||||
set -g TERM xterm-256color
|
||||
|
||||
if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
fish_vi_key_bindings
|
||||
# Commands to run in interactive sessions can go here
|
||||
fish_vi_key_bindings
|
||||
|
||||
|
||||
set -g fish_sequence_key_delay_ms 200
|
||||
bind -M insert -m default j,k cancel repaint-mode
|
||||
bind -M insert \cn \\t
|
||||
# Ctrl-o Find a file.
|
||||
# Ctrl-r Search through command history.
|
||||
# Alt-c cd into sub-directories (recursively searched).
|
||||
# Alt-Shift-c cd into sub-directories, including hidden ones.
|
||||
# Alt-o Open a file/dir using default editor ($EDITOR)
|
||||
# Alt-Shift-o Open a file/dir using xdg-open or open command
|
||||
|
||||
set -g fish_sequence_key_delay_ms 200
|
||||
bind -M insert -m default j,k cancel repaint-mode
|
||||
bind -M insert \cn \\t
|
||||
set -q KREW_ROOT; and set -gx PATH $PATH $KREW_ROOT/.krew/bin; or set -gx PATH $PATH $HOME/.krew/bin
|
||||
|
||||
alias claude="~/.claude/local/claude"
|
||||
# Check max tmux window in the Home session and open the Home session in a new tmux window
|
||||
# Find max window number in the Home session
|
||||
set TERM 'xterm-kitty'
|
||||
#if test -z "$TMUX";
|
||||
# # set name "$(date '+%Y%m%d_%H%M%S')"
|
||||
# # exec flock -w 1 -F -n "/tmp/zellij-$name" zellij -s "$name"
|
||||
# exec tmux
|
||||
#end
|
||||
# if test -z "$ZELLIJ";
|
||||
# # set name "$(date '+%Y%m%d_%H%M%S')"
|
||||
# # exec flock -w 1 -F -n "/tmp/zellij-$name" zellij -s "$name"
|
||||
# exec zellij
|
||||
# end
|
||||
|
||||
fzf_configure_bindings --git_status=\cg --history=\cr --variables= --processes=
|
||||
# Check max tmux window in the Home session and open the Home session in a new tmux window
|
||||
# Find max window number in the Home session
|
||||
set tmux_max_windows_in_home (tmux list-windows -t Home | awk '{print $1}' | sed 's/[^0-9]*//g' | sort -n | tail -n 1)
|
||||
if test -z "$TMUX"
|
||||
if test -n "$SSH_CONNECTION"
|
||||
tmux new-session -A -s Home
|
||||
else
|
||||
tmux new-session -A -s Home
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
function fish_prompt --description Hydro
|
||||
echo -e "$_hydro_color_start$hydro_symbol_start$hydro_color_normal$_hydro_color_pwd$_hydro_pwd$hydro_color_normal $_hydro_color_git$$_hydro_git$hydro_color_normal$_hydro_color_duration$_hydro_cmd_duration$hydro_color_normal$_hydro_status$hydro_color_normal "
|
||||
end
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
function mysql-reverse --description "Crea un tunnel SSH reverse per connettersi a MySQL" --argument-names ssh_host mysql_host password local_port
|
||||
# Verifica che tutti gli argomenti siano forniti
|
||||
if test (count $argv) -lt 3
|
||||
echo "Uso: mysql-reverse <ssh_host> <mysql_host> <password> [local_port]"
|
||||
echo ""
|
||||
echo "Argomenti:"
|
||||
echo " ssh_host - Host SSH per il tunnel (es: user@ssh.example.com)"
|
||||
echo " mysql_host - Host MySQL di destinazione (es: mysql1.example.com)"
|
||||
echo " password - Password per MySQL"
|
||||
echo " local_port - Porta locale per il tunnel (default: 3307)"
|
||||
return 1
|
||||
end
|
||||
|
||||
# Imposta la porta locale di default se non specificata
|
||||
set -l local_port $argv[4]
|
||||
if test -z "$local_port"
|
||||
set local_port 3307
|
||||
end
|
||||
|
||||
# Cerca una porta libera nel range di 10 porte
|
||||
set -l max_attempts 10
|
||||
set -l port_found 0
|
||||
set -l attempted_port $local_port
|
||||
|
||||
for i in (seq 0 (math $max_attempts - 1))
|
||||
set attempted_port (math $local_port + $i)
|
||||
|
||||
# Verifica se la porta è occupata usando netstat o ss
|
||||
if command -v ss >/dev/null
|
||||
ss -tuln | grep -q ":$attempted_port "
|
||||
set port_in_use $status
|
||||
else if command -v netstat >/dev/null
|
||||
netstat -tuln | grep -q ":$attempted_port "
|
||||
set port_in_use $status
|
||||
else
|
||||
# Se non ci sono strumenti disponibili, prova direttamente
|
||||
set port_in_use 1
|
||||
end
|
||||
|
||||
if test $port_in_use -ne 0
|
||||
# Porta libera trovata
|
||||
set port_found 1
|
||||
set local_port $attempted_port
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if test $port_found -eq 0
|
||||
echo "Errore: nessuna porta libera trovata"
|
||||
return 1
|
||||
end
|
||||
|
||||
echo "Usando porta locale: $local_port"
|
||||
|
||||
# Crea il tunnel SSH in background
|
||||
ssh -f $ssh_host -L $local_port:$mysql_host:3306 -N
|
||||
|
||||
# Connetti a MySQL attraverso il tunnel
|
||||
mysql -h 127.0.0.1 -P $local_port -p$password
|
||||
echo "Mysql reverse proxy on port $local_port"
|
||||
end
|
||||
Reference in New Issue
Block a user