Compare commits

...

10 Commits

Author SHA1 Message Date
davide f68a8d4158 feat: various cleans 2026-07-20 18:29:12 +02:00
davide 4e02228264 Soft reboot alias 2026-06-12 08:48:22 +02:00
davide cafb3f1ecb Varius 2026-04-20 09:40:17 +02:00
davide 876194e91b Some adds 2026-01-12 11:54:10 +01:00
davide 878aee5690 Fixes 2025-12-23 20:34:05 +01:00
davide 5ad8af0275 Fix 2025-12-10 12:20:34 +01:00
davide 00b2ca0bb8 Varius 2025-12-10 01:13:48 +01:00
davide 785c8af659 Aggiunto kcc e mod ls group 2025-11-18 16:18:07 +01:00
davide 7b9c7f118c Disabled default zelli 2025-11-07 11:34:19 +01:00
Davide Frattarolo 9b167944ae Varius 2025-09-30 18:24:18 +02:00
23 changed files with 542 additions and 37 deletions
+3
View File
@@ -0,0 +1,3 @@
if type -q atuin
atuin init fish | source
end
+14
View File
@@ -0,0 +1,14 @@
# This file was created by fish when upgrading to version 4.3, to migrate
# the 'fish_key_bindings' variable from its old default scope (universal)
# to its new default scope (global). We recommend you delete this file
# and configure key bindings in ~/.config/fish/config.fish if needed.
set --global fish_key_bindings fish_vi_key_bindings
# Prior to version 4.3, fish shipped an event handler that runs
# `set --universal fish_key_bindings fish_default_key_bindings`
# whenever the fish_key_bindings variable is erased.
# This means that as long as any fish < 4.3 is still running on this system,
# we cannot complete the migration.
# As a workaround, erase the universal variable at every shell startup.
set --erase --universal fish_key_bindings
+1
View File
@@ -0,0 +1 @@
eval "$(fnm env)"
+16 -14
View File
@@ -1,18 +1,20 @@
#abbr -a -- cd z
abbr -a -- opc opencode
abbr -a -- opcc opencode -c
abbr -a -- cl clear abbr -a -- cl clear
abbr -a -- tm tmux
abbr -a -- docker podman
abbr -a -- g git abbr -a -- g git
abbr -a -- l ezals abbr -a -- l lls
abbr -a -- ll 'ezals -TL2' abbr -a -- ls lls
abbr -a -- ls ezals abbr -a -- ll 'lls -TL2'
abbr -a -- q exit abbr -a -- q exit
abbr -a -- v nvim abbr -a -- v nvim
abbr -a --position anywhere --command git -- a add abbr -a -- vs nvim --server /tmp/nvim-server.sock
abbr -a --position anywhere --command git -- b branch abbr -a -- vo nvim --server /tmp/nvim-server.sock --remote-tab
abbr -a --position anywhere --command git -- c commit abbr -a -- kc kubectl --context
abbr -a --position anywhere --command git -- co checkout abbr -a -- kcc kubectl ctx
abbr -a --position anywhere --command git -- d diff abbr -a -- zj zellij
abbr -a --position anywhere --command git -- s status abbr -a -- sysc systemctl
abbr -a --position anywhere --command tmux -- r rename abbr -a -- syscu systemctl --user
abbr -a --position anywhere --command tmux -- rw renamew abbr -a -- diswn disown \(jobs -p\)
abbr -a -- rg rg --hyperlink-format kitty
abbr -a -- sreboot systemctl soft-reboot
+7
View File
@@ -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
+16
View File
@@ -0,0 +1,16 @@
while set pyenv_index (contains -i -- "/home/df/.pyenv/shims" $PATH)
set -eg PATH[$pyenv_index]; end; set -e pyenv_index
set -gx PATH '/home/df/.pyenv/shims' $PATH
set -gx PYENV_SHELL fish
command pyenv rehash
function pyenv
set command $argv[1]
set -e argv[1]
switch "$command"
case rehash shell
source (pyenv "sh-$command" $argv|psub)
case "*"
command pyenv "$command" $argv
end
end
+106
View File
@@ -0,0 +1,106 @@
# =============================================================================
#
# 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
if status list-files functions/cd.fish &>/dev/null
status get-file functions/cd.fish | string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' | source
else
string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' <$__fish_data_dir/functions/cd.fish | source
end
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 cd &>/dev/null
complete --erase --command cd
alias cd=__zoxide_z
abbr --erase cdi &>/dev/null
complete --erase --command cdi
alias cdi=__zoxide_zi
# =============================================================================
#
# To initialize zoxide, add this to your configuration (usually
# ~/.config/fish/config.fish):
#
# zoxide init fish | source
+35 -15
View File
@@ -1,26 +1,46 @@
set -g fish_greeting "Hi Dadd" set -g fish_greeting "Hi Dadd"
# set nvim editor # Set editor
set -g EDITOR nvim set -gx EDITOR nvim
set -gx KUBE_EDITOR nvim
set -g TERM xterm-256color
# For enable nvim server, first instance become the listener
#set -gx NVIM_LISTEN_ADDRESS /tmp/nvim-server.sock
if status is-interactive if status is-interactive
# Commands to run in interactive sessions can go here # Commands to run in interactive sessions can go here
fish_vi_key_bindings fish_vi_key_bindings
set -g fish_sequence_key_delay_ms 200 set -g fish_sequence_key_delay_ms 200
bind -M insert -m default j,k cancel repaint-mode bind -M insert -m default j,k cancel repaint-mode
bind -M insert \cn \\t
fzf_configure_bindings --git_status=\cg --history=\cr --variables= --processes= # \c Ctrl, \e Alt
# Check max tmux window in the Home session and open the Home session in a new tmux window bind -M insert \cy 'y; commandline -f repaint'
# Find max window number in the Home session bind -M insert \cv 'nvim; commandline -f repaint'
set tmux_max_windows_in_home (tmux list-windows -t Home | awk '{print $1}' | sed 's/[^0-9]*//g' | sort -n | tail -n 1) set -q KREW_ROOT; and set -gx PATH $PATH $KREW_ROOT/.krew/bin; or set -gx PATH $PATH $HOME/.krew/bin
if test -z "$TMUX"
if test -n "$SSH_CONNECTION" set -U autovenv_enable yes
tmux new-session -A -s Home set -U autovenv_announce yes
else set -U autovenv_dir .venv
tmux new-session -A -s Home
end git-refresh
end
end end
fish_add_path /home/df/.opencode/bin
# Added by LM Studio CLI (lms)
set -gx PATH $PATH /home/df/.lmstudio/bin
# End of LM Studio CLI section
# bun
set --export BUN_INSTALL "$HOME/.bun"
set --export PATH $BUN_INSTALL/bin $PATH
# Go
fish_add_path $HOME/go/bin
# Cargo (Rust)
fish_add_path $HOME/.cargo/bin
alias claude 'claude --allow-dangerously-skip-permissions'
+12
View File
@@ -0,0 +1,12 @@
function duh --description "Disk usage utility"
if test (count $argv) -eq 0
#echo "duh: missing operand" >&2
#return 1
set fold '.'
else
set fold $argv
end
du -hd1 $fold | sort -h
end
-3
View File
@@ -1,3 +0,0 @@
function ezals --wraps='eza --icons --git --no-user --octal-permissions --no-permissions -s name -lah' --description 'Base exa'
eza --icons --git --no-user --octal-permissions --no-permissions -s name -lah $argv
end
+3
View File
@@ -0,0 +1,3 @@
function fish_preexec --on-event fish_preexec
set -g __fish_prompt_command_ran 1
end
+154 -2
View File
@@ -1,3 +1,155 @@
function fish_prompt --description Hydro function fish_prompt --description 'Write out the prompt'
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 " set -l last_pipestatus $pipestatus
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
# Blank line before prompt only after a command was executed
if set -q __fish_prompt_command_ran
echo
set -e __fish_prompt_command_ran
end
if not set -q __fish_git_prompt_show_informative_status
set -g __fish_git_prompt_show_informative_status 1
end
if not set -q __fish_git_prompt_hide_untrackedfiles
set -g __fish_git_prompt_hide_untrackedfiles 1
end
if not set -q __fish_git_prompt_color_branch
set -g __fish_git_prompt_color_branch magenta --bold
end
if not set -q __fish_git_prompt_showupstream
set -g __fish_git_prompt_showupstream informative
end
if not set -q __fish_git_prompt_color_dirtystate
set -g __fish_git_prompt_color_dirtystate blue
end
if not set -q __fish_git_prompt_color_stagedstate
set -g __fish_git_prompt_color_stagedstate yellow
end
if not set -q __fish_git_prompt_color_invalidstate
set -g __fish_git_prompt_color_invalidstate red
end
if not set -q __fish_git_prompt_color_untrackedfiles
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
end
if not set -q __fish_git_prompt_color_cleanstate
set -g __fish_git_prompt_color_cleanstate green --bold
end
set -l color_cwd
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
else
set color_cwd $fish_color_cwd
end
# Vim mode indicator
set -l vim_mode
switch $fish_bind_mode
case default
set vim_mode (set_color brwhite --bold)"N"(set_color normal)
case insert
set vim_mode (set_color green --bold)"I"(set_color normal)
case visual
set vim_mode (set_color yellow --bold)"V"(set_color normal)
case replace
set vim_mode (set_color red --bold)"R"(set_color normal)
end
echo -n $vim_mode" "
# Time
set_color brblack
echo -n (date '+%H:%M:%S')
set_color normal
echo -n ' '
# Last command duration
if test -n "$CMD_DURATION" -a "$CMD_DURATION" -gt 0
set -l secs (math --scale=0 "$CMD_DURATION / 1000")
if test $secs -gt 0
set_color yellow
if test $secs -ge 60
set -l mins (math --scale=0 "$secs / 60")
set -l rem (math --scale=0 "$secs % 60")
echo -n $mins"m"$rem"s "
else
echo -n $secs"s "
end
set_color normal
end
end
# User@host
set_color brgreen
echo -n $USER
set_color normal
echo -n @
set_color brblue
echo -n (prompt_hostname)
set_color normal
echo -n ' '
# Dirh position: {back}< />{fwd} {back}<>{fwd}
set -l back (count $dirprev)
set -l fwd (count $dirnext)
if test $back -gt 0 -o $fwd -gt 0
set_color brblack
if test $back -gt 0
echo -n $back
end
if test $back -gt 0 -a $fwd -gt 0
echo -n "<>"
else if test $back -gt 0
echo -n "<"
else
echo -n ">"
end
if test $fwd -gt 0
echo -n $fwd
end
set_color normal
echo -n ' '
end
# PWD
set_color $color_cwd
echo -n (prompt_pwd)
set_color normal
# Git + Kubernetes cluster
set -l vcs (fish_vcs_prompt)
if test -n "$vcs"
printf '%s' $vcs
# Kubernetes context
if command -sq kubectl
set -l kctx (kubectl config current-context 2>/dev/null)
if test -n "$kctx"
set_color brblack
echo -n " [$kctx]"
set_color normal
end
end
end
echo -n ' '
set -l status_color (set_color $fish_color_status)
set -l statusb_color (set_color --bold $fish_color_status)
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
echo -n $prompt_status
set_color normal
# Background jobs counter
set -l jobs_count (count (jobs -p))
if test $jobs_count -gt 0
set_color yellow
echo -n "[$jobs_count] "
set_color normal
end
# Prompt on new line
echo
end end
+2
View File
@@ -0,0 +1,2 @@
function fish_right_prompt
end
+6
View File
@@ -0,0 +1,6 @@
function fish_user_key_bindings
# Bind k to Atuin search in vim normal mode
if type -q atuin
bind -M default k _atuin_bind_up
end
end
+25
View File
@@ -0,0 +1,25 @@
# git-refresh initialization hook
#
# You can use the following variables in this file:
# * $package package name
# * $path package path
# * $dependencies package dependencies
# Timeout in seconds before allowing another git pull (default: 60 minutes)
set -q GIT_REFRESH_TIMEOUT; or set -g GIT_REFRESH_TIMEOUT 3600
function git-refresh --on-variable PWD \
--description "git pull automatically wherever inside a git repository"
test -d .git; or return
set --local fetch_head .git/FETCH_HEAD
if test -f $fetch_head
set --local age (math (date +%s) - (stat -c %Y $fetch_head 2>/dev/null; or stat -f %m $fetch_head))
if test $age -lt $GIT_REFRESH_TIMEOUT
return
end
end
echo -e "\e[1m(git-refresh) - GIT repo detected\e[0m"
git pull --all --verbose
end
+3
View File
@@ -0,0 +1,3 @@
function hn --description "Registra e trascrive voce in testo (Hns wrapper)"
HNS_LANG=it HNS_WHISPER_MODEL=medium hns
end
+3
View File
@@ -0,0 +1,3 @@
function lls --wraps='eza --icons --git --no-user --octal-permissions --no-permissions --group-directories-first -s name -lah' --description 'Base exa'
eza --icons --git --no-user --octal-permissions --no-permissions --group-directories-first -s name --hyperlink -lah $argv
end
+32
View File
@@ -0,0 +1,32 @@
function mkd --description 'Create directory(ies) and cd into the first one'
if test (count $argv) -eq 0
echo "mkd: missing operand" >&2
return 1
end
# Parse options and directories
set -l options
set -l directories
set -l first_dir
for arg in $argv
if string match -q -- '-*' $arg
set -a options $arg
else
set -a directories $arg
# Store the first directory
if test -z "$first_dir"
set first_dir $arg
end
end
end
# Create directories with all options
if test (count $directories) -gt 0
mkdir $options $directories
and cd $first_dir
else
echo "mkd: no directory specified" >&2
return 1
end
end
+62
View File
@@ -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
+6
View File
@@ -0,0 +1,6 @@
function omo -d "Lancia opencode con la configurazione omo"
set -lx OPENCODE_CONFIG ~/.config/omo/opencode.jsonc
set -lx OPENCODE_TUI_CONFIG ~/.config/omo/tui.json
set -lx XDG_DATA_HOME ~/.local/share/omo
opencode $argv
end
+15
View File
@@ -0,0 +1,15 @@
# worktrunk shell integration for fish
# Sources full integration from binary on first use.
# Docs: https://worktrunk.dev/config/#shell-integration
# Check: wt config show | Uninstall: wt config shell uninstall
function wt
command wt config shell init fish | source
# Check both command exit code ($pipestatus[1]) and source exit code ($pipestatus[2])
# If source fails, the function isn't replaced and we'd infinite-loop calling ourselves
set -l wt_status $pipestatus[1]
set -l source_status $pipestatus[2]
test $wt_status -eq 0; or return $wt_status
test $source_status -eq 0; or return $source_status
wt $argv
end
+10
View File
@@ -0,0 +1,10 @@
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if read -z cwd <"$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
clear
lls
end
+8
View File
@@ -0,0 +1,8 @@
function zjs -d "Avvia zellij in una nuova finestra TERM"
if test (count $argv) -eq 0
$TERM -e zellij &
else
$TERM -e zellij attach -c $argv[1] &
end
disown
end