feat(shell): expand tricks.fish with system aliases, bat man pages, and done plugin
- Add system aliases: dot-navigation (.., ..., etc.), color overrides for grep/dir/vdir, safety wrappers (cp/mv/rm -i), archive shortcuts (tarnow, untar), wget resume, tb (termbin), and jctl - Set MANPAGER/MANROFFOPT to render man pages through bat when available - Configure franciscolourenco/done notification plugin settings (__done_min_cmd_duration=10s, __done_notification_urgency_level=low) - Add psmem/psmem10 memory-monitoring helpers - Switch PATH setup to fish_add_path (handles deduplication automatically) - Add conf.d/done.fish (done plugin v1.19.1) - Source tricks.fish explicitly after CachyOS base config in config.fish - Sync README with all new functions, aliases, and integrations
This commit is contained in:
+55
-14
@@ -4,27 +4,28 @@
|
||||
# ────── Borrowed and modified from CachyOS config ─────────
|
||||
# ╭──────────────────────────────────────────────────────────╮
|
||||
# │ Provides PATH additions, bang-bang helpers, │
|
||||
# │ and history/backup utilities │
|
||||
# │ system aliases, and history/backup utilities │
|
||||
# ╰──────────────────────────────────────────────────────────╯
|
||||
|
||||
## Environment setup
|
||||
# Apply .profile: use this to put fish compatible .profile stuff in
|
||||
if test -f ~/.fish_profile
|
||||
source ~/.fish_profile
|
||||
end
|
||||
|
||||
# Add ~/.local/bin to PATH
|
||||
if test -d ~/.local/bin
|
||||
if not contains -- ~/.local/bin $PATH
|
||||
set -p PATH ~/.local/bin
|
||||
end
|
||||
# Append unique directories to $PATH (fish_add_path handles duplicates automatically)
|
||||
fish_add_path ~/.local/bin
|
||||
fish_add_path ~/Applications/depot_tools
|
||||
|
||||
# Format man pages using bat (only if bat is installed)
|
||||
if type -q bat
|
||||
set -gx MANROFFOPT -c
|
||||
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
||||
end
|
||||
|
||||
# Add depot_tools to PATH
|
||||
if test -d ~/Applications/depot_tools
|
||||
if not contains -- ~/Applications/depot_tools $PATH
|
||||
set -p PATH ~/Applications/depot_tools
|
||||
end
|
||||
end
|
||||
# Set settings for https://github.com/franciscolourenco/done
|
||||
set -gx __done_min_cmd_duration 10000
|
||||
set -gx __done_notification_urgency_level low
|
||||
|
||||
## Functions
|
||||
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
|
||||
@@ -48,8 +49,8 @@ function __history_previous_command_arguments
|
||||
end
|
||||
end
|
||||
|
||||
# Apply bang-bang key bindings based on current key binding mode
|
||||
if [ "$fish_key_bindings" = fish_vi_key_bindings ]
|
||||
|
||||
bind -Minsert ! __history_previous_command
|
||||
bind -Minsert '$' __history_previous_command_arguments
|
||||
else
|
||||
@@ -57,11 +58,51 @@ else
|
||||
bind '$' __history_previous_command_arguments
|
||||
end
|
||||
|
||||
# Fish command history
|
||||
# Fish command history override to show timestamps
|
||||
function history
|
||||
builtin history --show-time='%F %T '
|
||||
end
|
||||
|
||||
# Quick file backup utility
|
||||
function backup --argument filename
|
||||
cp $filename $filename.bak
|
||||
end
|
||||
|
||||
# Memory monitoring helpers
|
||||
function psmem
|
||||
ps auxf | sort -nr -k 4
|
||||
end
|
||||
|
||||
function psmem10
|
||||
ps auxf | sort -nr -k 4 | head -10
|
||||
end
|
||||
|
||||
## Useful aliases
|
||||
|
||||
# Navigation short-cuts
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias .....='cd ../../../..'
|
||||
alias ......='cd ../../../../..'
|
||||
|
||||
# Tools & Core command color overrides
|
||||
alias dir='dir --color=auto'
|
||||
alias vdir='vdir --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
# Safety aliases (Confirmation before overwriting/deleting)
|
||||
alias cp="cp -i"
|
||||
alias mv="mv -i"
|
||||
alias rm="rm -i"
|
||||
|
||||
# Archives and networking short-hands
|
||||
alias tarnow='tar -acf '
|
||||
alias untar='tar -zxvf '
|
||||
alias wget='wget -c '
|
||||
alias tb='nc termbin.com 9999'
|
||||
|
||||
# System Logs
|
||||
alias jctl="journalctl -p 3 -xb"
|
||||
|
||||
Reference in New Issue
Block a user