Fix Fish shell configuration

- Remove loading asdf env variables
- Add loading Homebrew
- Move Yazi function to config.fish
- Fix Go binary path
This commit is contained in:
Fabio Scotto di Santolo
2024-07-24 09:12:14 +02:00
parent ac9881b7f8
commit 543a9c8241
5 changed files with 43 additions and 42 deletions

View File

@@ -1 +0,0 @@
source ~/.asdf/asdf.fish

View File

@@ -0,0 +1 @@
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

View File

@@ -1,14 +1,14 @@
## Set values ## Set values
# Hide welcome message & ensure we are reporting fish as shell # Hide welcome message & ensure we are reporting fish as shell
set fish_greeting set fish_greeting
set VIRTUAL_ENV_DISABLE_PROMPT "1" set VIRTUAL_ENV_DISABLE_PROMPT 1
set -xU MANPAGER "sh -c 'col -bx | bat -l man -p'" set -xU MANPAGER "sh -c 'col -bx | bat -l man -p'"
set -xU MANROFFOPT "-c" set -xU MANROFFOPT -c
set -x SHELL /usr/bin/fish set -x SHELL /usr/bin/fish
## Export variable need for qt-theme ## Export variable need for qt-theme
if type "qtile" >> /dev/null 2>&1 if type qtile >>/dev/null 2>&1
set -x QT_QPA_PLATFORMTHEME "qt5ct" set -x QT_QPA_PLATFORMTHEME qt5ct
end end
# Set settings for https://github.com/franciscolourenco/done # Set settings for https://github.com/franciscolourenco/done
@@ -19,7 +19,7 @@ set -U __done_notification_urgency_level low
## Environment setup ## Environment setup
# Apply .profile: use this to put fish compatible .profile stuff in # Apply .profile: use this to put fish compatible .profile stuff in
if test -f ~/.fish_profile if test -f ~/.fish_profile
source ~/.fish_profile source ~/.fish_profile
end end
# Add ~/.local/bin to PATH # Add ~/.local/bin to PATH
@@ -31,8 +31,8 @@ end
## Starship prompt ## Starship prompt
if status --is-interactive if status --is-interactive
set -l starship_path (which starship) set -l starship_path (which starship)
source ("$starship_path" init fish --print-full-init | psub) source ($starship_path init fish --print-full-init | psub)
end end
## Advanced command-not-found hook ## Advanced command-not-found hook
@@ -50,30 +50,31 @@ end
## Functions ## Functions
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang # Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
function __history_previous_command function __history_previous_command
switch (commandline -t) switch (commandline -t)
case "!" case "!"
commandline -t $history[1]; commandline -f repaint commandline -t $history[1]
case "*" commandline -f repaint
commandline -i ! case "*"
end commandline -i !
end
end end
function __history_previous_command_arguments function __history_previous_command_arguments
switch (commandline -t) switch (commandline -t)
case "!" case "!"
commandline -t "" commandline -t ""
commandline -f history-token-search-backward commandline -f history-token-search-backward
case "*" case "*"
commandline -i '$' commandline -i '$'
end end
end end
if [ "$fish_key_bindings" = fish_vi_key_bindings ]; if [ "$fish_key_bindings" = fish_vi_key_bindings ]
bind -Minsert ! __history_previous_command bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments bind -Minsert '$' __history_previous_command_arguments
else else
bind ! __history_previous_command bind ! __history_previous_command
bind '$' __history_previous_command_arguments bind '$' __history_previous_command_arguments
end end
# Fish command history # Fish command history
@@ -89,8 +90,8 @@ end
function copy function copy
set count (count $argv | tr -d \n) set count (count $argv | tr -d \n)
if test "$count" = 2; and test -d "$argv[1]" if test "$count" = 2; and test -d "$argv[1]"
set from (echo $argv[1] | string trim --right --chars=/) set from (echo $argv[1] | string trim --right --chars=/)
set to (echo $argv[2]) set to (echo $argv[2])
command cp -r $from $to command cp -r $from $to
else else
command cp $argv command cp $argv
@@ -116,12 +117,21 @@ function tmux-session --argument session_name
end end
end end
function yy
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
cd -- "$cwd"
end
rm -f -- "$tmp"
end
## Useful aliases ## Useful aliases
# Replace ls with eza # Replace ls with eza
alias ls 'eza --color=always --group-directories-first --icons' # preferred listing alias ls 'eza --color=always --group-directories-first --icons' # preferred listing
alias la 'eza -a --color=always --group-directories-first --icons' # all files and dirs alias la 'eza -a --color=always --group-directories-first --icons' # all files and dirs
alias ll 'eza -l --color=always --group-directories-first --icons' # long format alias ll 'eza -l --color=always --group-directories-first --icons' # long format
alias lt 'eza -aT --color=always --group-directories-first --icons' # tree listing alias lt 'eza -aT --color=always --group-directories-first --icons' # tree listing
alias l. 'eza -ald --color=always --group-directories-first --icons .*' # show only dotfiles alias l. 'eza -ald --color=always --group-directories-first --icons .*' # show only dotfiles
@@ -142,7 +152,7 @@ alias grep 'ugrep --color=auto'
alias egrep 'ugrep -E --color=auto' alias egrep 'ugrep -E --color=auto'
alias fgrep 'ugrep -F --color=auto' alias fgrep 'ugrep -F --color=auto'
alias grubup 'sudo update-grub' alias grubup 'sudo update-grub'
alias hw 'hwinfo --short' # Hardware Info alias hw 'hwinfo --short' # Hardware Info
alias ip 'ip -color' alias ip 'ip -color'
alias psmem 'ps auxf | sort -nr -k 4' alias psmem 'ps auxf | sort -nr -k 4'
alias psmem10 'ps auxf | sort -nr -k 4 | head -10' alias psmem10 'ps auxf | sort -nr -k 4 | head -10'
@@ -150,9 +160,8 @@ alias tarnow 'tar -acf '
alias untar 'tar -zxvf ' alias untar 'tar -zxvf '
alias vdir 'vdir --color=auto' alias vdir 'vdir --color=auto'
alias wget 'wget -c ' alias wget 'wget -c '
alias vi 'nvim' alias vi nvim
alias stow 'stow --dotfiles -d ~/.dotfiles ' alias stow 'stow --dotfiles -d ~/.dotfiles '
# Get the error messages from journalctl # Get the error messages from journalctl
alias jctl 'journalctl -p 3 -xb' alias jctl 'journalctl -p 3 -xb'

View File

@@ -44,4 +44,4 @@ SETUVAR fish_pager_color_description:yellow\x1e\x2di
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_selected_background:\x2dr SETUVAR fish_pager_color_selected_background:\x2dr
SETUVAR fish_user_paths:/var/home/fscotto/\x2elocal/share/go SETUVAR fish_user_paths:/home/fscotto/\x2elocal/share/go/bin

View File

@@ -1,8 +0,0 @@
function yy
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
cd -- "$cwd"
end
rm -f -- "$tmp"
end