.dotfiles/private_dot_config/fish/config.fish
tombdf 04fd30ca73
feat!: Alter most of major config files
- Bash: config file
- Zsh: config file
- Fish: config file and fish plugins
- Nvim: config files
- Kitty: config files
2025-01-03 00:39:01 +01:00

161 lines
5.7 KiB
Fish

############################################################################################################
#
# ██████╗ ██████╗ ███╗ ██╗███████╗██╗ ██████╗ ███████╗██╗███████╗██╗ ██╗
# ██╔════╝██╔═══██╗████╗ ██║██╔════╝██║██╔════╝ ██╔════╝██║██╔════╝██║ ██║
# ██║ ██║ ██║██╔██╗ ██║█████╗ ██║██║ ███╗ █████╗ ██║███████╗███████║
# ██║ ██║ ██║██║╚██╗██║██╔══╝ ██║██║ ██║ ██╔══╝ ██║╚════██║██╔══██║
# ╚██████╗╚██████╔╝██║ ╚████║██║ ██║╚██████╔╝██╗██║ ██║███████║██║ ██║
# ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
#
############################################################################################################
# Fish configuration ------------------------------------------------------------- {{{
set fish_greeting
export LS_COLORS="$(vivid generate gruvbox-dark)"
# Plugins installation and configuration ------------------------------------------------------------- {{{
# Check if fisher is installed
if not set -q _fisher_plugins
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
end
# Configuration for automatic Fisher package manager updates
# Update interval is set to one day (86400 seconds)
set -g FISHER_UPDATE_INTERVAL 86400
set -g fisher_update_timestamp_file ~/.cache/fisher_last_update
# Get the last modification timestamp of a file
function get_file_timestamp
stat --format=%Y "$argv[1]" 2>/dev/null
end
# Check if Fisher needs to be updated based on the timestamp file
function needs_update
set -l current_time (date +%s)
if not test -e "$fisher_update_timestamp_file"
return 0
end
set -l file_time (get_file_timestamp "$fisher_update_timestamp_file")
test "$current_time" -gt 0 -a "$file_time" -gt 0
and test (math "$current_time - $file_time") -gt $FISHER_UPDATE_INTERVAL
end
# Update Fisher packages if needed and update timestamp
function update_fisher
mkdir -p (dirname $fisher_update_timestamp_file)
if needs_update
fisher update > /dev/null 2>&1
touch "$fisher_update_timestamp_file"
end
end
# Run Fisher update check only in interactive shells
if status is-interactive
update_fisher
end
theme_gruvbox dark soft
set sponge_regex_patterns '^\s+.*'
set sponge_allow_previously_successful true
# }}}
# Completion ------------------------------------------------------------- {{{
if command -v atuin >/dev/null 2>&1 && not test -f $HOME/.config/fish/completions/atuin.fish
atuin gen-completions --shell fish --out-dir $HOME/.config/fish/completions
echo "Atuin completions generated"
end
if command -v chezmoi >/dev/null 2>&1 && not test -f $HOME/.config/fish/completions/chezmoi.fish
chezmoi completion fish --output=$HOME/.config/fish/completions/chezmoi.fish
echo "Chezmoi completions generated"
end
if command -v rip >/dev/null 2>&1 && not test -f $HOME/.config/fish/completions/rip.fish
rip completion fish > $HOME/.config/fish/completions/rip.fish
echo "Rip completions generated"
end
# }}}
# }}}
# User configuration ---------------------------------------------------------------- {{{
# SSH Configuration ---------------------------------------------------------------- {{{
# Preferred editor for local and remote sessions
if not set -q SSH_CONNECTION
set -x EDITOR nvim
else
set -x EDITOR vim
end
# Set the ssh agent if it is not already running
if not pgrep ssh-agent >/dev/null
eval (ssh-agent -s)
end
# Function to add SSH keys to the agent
function add_ssh_key
set key_path $argv[1]
set key_name (basename $key_path)
if test -f $key_path; and not ssh-add -l | grep -q $key_name
ssh-add $key_path > /dev/null 2>&1
end
end
# Add personal SSH keys
add_ssh_key ~/.ssh/id_ed25519
add_ssh_key ~/.ssh/hexasec
# }}}
# Aliases ---------------------------------------------------------------- {{{
# For a full list of active aliases, run `alias`.
alias ls='lsd'
alias ll='ls -alF'
alias rm='rip'
alias cat='bat'
alias grep='rg'
alias find='fd -H'
alias sed='sd'
alias c='clear'
alias prolog='~/.config/scryer-prolog/target/release/scryer-prolog' # À remplacer par prolog='scryer-prolog'
alias csc='sudo cytech-site-change'
alias quit='exit'
alias compresse='echo "tar -cv [nomDuFichieràCompresser] -f [nomArchive].tar"'
alias maj='~/./miseajour.sh'
alias vi=(which vim)
alias vim='nvim'
# }}}
# }}}
# Shell enhancements initialization ---------------------------------------------------------------- {{{
# Set the Oh-My-Posh prompt
#oh-my-posh init fish --config $HOME/.config/ohmyposh/prompt.json | source
# Or Starship
function starship_transient_prompt_func
starship module character
end
starship init fish | source
enable_transience
# Allow zoxide to work and to replace cd
zoxide init --cmd cd fish | source
# Set atuin
atuin init fish | source
# }}}