feat: various cleans
This commit is contained in:
+2
-86
@@ -1,87 +1,3 @@
|
|||||||
set -gx ATUIN_SESSION (atuin uuid)
|
if type -q atuin
|
||||||
set --erase ATUIN_HISTORY_ID
|
atuin init fish | source
|
||||||
|
|
||||||
function _atuin_preexec --on-event fish_preexec
|
|
||||||
if not test -n "$fish_private_mode"
|
|
||||||
set -g ATUIN_HISTORY_ID (atuin history start -- "$argv[1]")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function _atuin_postexec --on-event fish_postexec
|
|
||||||
set -l s $status
|
|
||||||
|
|
||||||
if test -n "$ATUIN_HISTORY_ID"
|
|
||||||
ATUIN_LOG=error atuin history end --exit $s -- $ATUIN_HISTORY_ID &>/dev/null &
|
|
||||||
disown
|
|
||||||
end
|
|
||||||
|
|
||||||
set --erase ATUIN_HISTORY_ID
|
|
||||||
end
|
|
||||||
|
|
||||||
function _atuin_search
|
|
||||||
set -l keymap_mode
|
|
||||||
switch $fish_key_bindings
|
|
||||||
case fish_vi_key_bindings
|
|
||||||
switch $fish_bind_mode
|
|
||||||
case default
|
|
||||||
set keymap_mode vim-normal
|
|
||||||
case insert
|
|
||||||
set keymap_mode vim-insert
|
|
||||||
end
|
|
||||||
case '*'
|
|
||||||
set keymap_mode emacs
|
|
||||||
end
|
|
||||||
|
|
||||||
# In fish 3.4 and above we can use `"$(some command)"` to keep multiple lines separate;
|
|
||||||
# but to support fish 3.3 we need to use `(some command | string collect)`.
|
|
||||||
# https://fishshell.com/docs/current/relnotes.html#id24 (fish 3.4 "Notable improvements and fixes")
|
|
||||||
set -l ATUIN_H (ATUIN_SHELL=fish ATUIN_LOG=error ATUIN_QUERY=(commandline -b) atuin search --keymap-mode=$keymap_mode $argv -i 3>&1 1>&2 2>&3 | string collect)
|
|
||||||
|
|
||||||
if test -n "$ATUIN_H"
|
|
||||||
if string match --quiet '__atuin_accept__:*' "$ATUIN_H"
|
|
||||||
set -l ATUIN_HIST (string replace "__atuin_accept__:" "" -- "$ATUIN_H" | string collect)
|
|
||||||
commandline -r "$ATUIN_HIST"
|
|
||||||
commandline -f repaint
|
|
||||||
commandline -f execute
|
|
||||||
return
|
|
||||||
else
|
|
||||||
commandline -r "$ATUIN_H"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
commandline -f repaint
|
|
||||||
end
|
|
||||||
|
|
||||||
function _atuin_bind_up
|
|
||||||
# Fallback to fish's builtin up-or-search if we're in search or paging mode
|
|
||||||
if commandline --search-mode; or commandline --paging-mode
|
|
||||||
up-or-search
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
# Only invoke atuin if we're on the top line of the command
|
|
||||||
set -l lineno (commandline --line)
|
|
||||||
|
|
||||||
switch $lineno
|
|
||||||
case 1
|
|
||||||
_atuin_search --shell-up-key-binding
|
|
||||||
case '*'
|
|
||||||
up-or-search
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if string match -q '4.*' $version
|
|
||||||
bind ctrl-r _atuin_search
|
|
||||||
bind up _atuin_bind_up
|
|
||||||
if bind -M insert >/dev/null 2>&1
|
|
||||||
bind -M insert ctrl-r _atuin_search
|
|
||||||
bind -M insert up _atuin_bind_up
|
|
||||||
end
|
|
||||||
else
|
|
||||||
bind \cr _atuin_search
|
|
||||||
bind -k up _atuin_bind_up; bind \eOA _atuin_bind_up; bind \e\[A _atuin_bind_up
|
|
||||||
if bind -M insert >/dev/null 2>&1
|
|
||||||
bind -M insert \cr _atuin_search
|
|
||||||
bind -M insert -k up _atuin_bind_up; bind -M insert \eOA _atuin_bind_up; bind -M insert \e\[A _atuin_bind_up
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
-31
@@ -8,34 +8,16 @@ set -g TERM xterm-256color
|
|||||||
# For enable nvim server, first instance become the listener
|
# For enable nvim server, first instance become the listener
|
||||||
#set -gx NVIM_LISTEN_ADDRESS /tmp/nvim-server.sock
|
#set -gx NVIM_LISTEN_ADDRESS /tmp/nvim-server.sock
|
||||||
|
|
||||||
# Set correct TERM and TERMINAL for kitty
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
# Disable flow control (Ctrl+S/Ctrl+Q) to prevent terminal freeze
|
|
||||||
# stty -ixon
|
|
||||||
|
|
||||||
# Handle spurious cursor position reports that might appear in prompt
|
|
||||||
# This happens when background jobs query the terminal
|
|
||||||
|
|
||||||
# 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
|
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
|
||||||
|
|
||||||
# \c Ctrl, \e Alt
|
# \c Ctrl, \e Alt
|
||||||
bind -M insert \cy 'y; commandline -f repaint'
|
bind -M insert \cy 'y; commandline -f repaint'
|
||||||
bind -M insert \cv 'nvim; commandline -f repaint'
|
bind -M insert \cv 'nvim; commandline -f repaint'
|
||||||
bind -M insert \cz 'zellij; commandline -f repaint'
|
|
||||||
bind -M insert \cx 'set -l dir (zoxide query -l | fzf --height 40% --reverse); and cd $dir; commandline -f repaint'
|
|
||||||
bind -M insert \cu forward-char
|
|
||||||
set -q KREW_ROOT; and set -gx PATH $PATH $KREW_ROOT/.krew/bin; or set -gx PATH $PATH $HOME/.krew/bin
|
set -q KREW_ROOT; and set -gx PATH $PATH $KREW_ROOT/.krew/bin; or set -gx PATH $PATH $HOME/.krew/bin
|
||||||
|
|
||||||
set -U autovenv_enable yes
|
set -U autovenv_enable yes
|
||||||
@@ -43,19 +25,6 @@ if status is-interactive
|
|||||||
set -U autovenv_dir .venv
|
set -U autovenv_dir .venv
|
||||||
|
|
||||||
git-refresh
|
git-refresh
|
||||||
# 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
|
|
||||||
#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
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
fish_add_path /home/df/.opencode/bin
|
fish_add_path /home/df/.opencode/bin
|
||||||
|
|||||||
@@ -47,6 +47,20 @@ function fish_prompt --description 'Write out the prompt'
|
|||||||
set color_cwd $fish_color_cwd
|
set color_cwd $fish_color_cwd
|
||||||
end
|
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
|
# Time
|
||||||
set_color brblack
|
set_color brblack
|
||||||
echo -n (date '+%H:%M:%S')
|
echo -n (date '+%H:%M:%S')
|
||||||
@@ -79,6 +93,28 @@ function fish_prompt --description 'Write out the prompt'
|
|||||||
set_color normal
|
set_color normal
|
||||||
echo -n ' '
|
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
|
# PWD
|
||||||
set_color $color_cwd
|
set_color $color_cwd
|
||||||
echo -n (prompt_pwd)
|
echo -n (prompt_pwd)
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ function git-refresh --on-variable PWD \
|
|||||||
if test -f $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))
|
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
|
if test $age -lt $GIT_REFRESH_TIMEOUT
|
||||||
echo -e "\e[1m(git-refresh) - Cooldown: "(math $GIT_REFRESH_TIMEOUT - $age)"s remaining\e[0m"
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
function hn --description "Registra e trascrive voce in testo (Hns wrapper)"
|
||||||
|
HNS_LANG=it HNS_WHISPER_MODEL=medium hns
|
||||||
|
end
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user