From 637fd9d110398fa5f7e58969e8885d85f8739c89 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Wed, 9 Oct 2024 11:55:06 +1300 Subject: [PATCH] Add fish aliases and functions --- fish/conf.d/aliases.fish | 7 +++++++ fish/conf.d/clipboard.fish | 11 +++++++++++ fish/conf.d/git.fish | 4 ++++ 3 files changed, 22 insertions(+) create mode 100644 fish/conf.d/aliases.fish create mode 100644 fish/conf.d/clipboard.fish diff --git a/fish/conf.d/aliases.fish b/fish/conf.d/aliases.fish new file mode 100644 index 0000000..fe10e5e --- /dev/null +++ b/fish/conf.d/aliases.fish @@ -0,0 +1,7 @@ +# alias ~='cd ~' +alias c-='cd -' +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' +alias ......='cd ../../../../..' diff --git a/fish/conf.d/clipboard.fish b/fish/conf.d/clipboard.fish new file mode 100644 index 0000000..5f67caf --- /dev/null +++ b/fish/conf.d/clipboard.fish @@ -0,0 +1,11 @@ +# Aliases for scripts in ~/bin +# ---------------------------- +alias cb="simple_clipboard" +# Copy contents of a file +alias cbf="simple_clipboard <" +# Copy SSH public key +alias cbs="echo 'Copying ~/.ssh/id_rsa.pub to clipboard...' && simple_clipboard < ~/.ssh/id_rsa.pub" +# Copy current working directory +alias cbd="pwd | simple_clipboard" +# Copy current git SHA-1 +alias cbg="echo 'Copying latest commit hash to clipboard...' && git rev-parse --verify HEAD | simple_clipboard" diff --git a/fish/conf.d/git.fish b/fish/conf.d/git.fish index 795d235..971cb87 100644 --- a/fish/conf.d/git.fish +++ b/fish/conf.d/git.fish @@ -17,6 +17,10 @@ alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset % abbr -a gsf "git show --oneline --name-only" alias gdi="git --no-pager -c diff.image.textconv=imgcat -c diff.image.command=imgdiff diff" +# Adds all changes to current commit and then force pushes. +# Never use this on a team project!! +alias GFORCE='git add -A && git commit --amend -C HEAD && git push -f' + function grbi if test (count $argv) -eq 0 git rebase -i HEAD~10