abbreviations.fish The Abbreviations Configuration

The abbreviations the file goes into ~/.config/fish/conf.d/.

Abbreviations are sort of like aliases except fish will expand them once you hit space or enter. If, for example, you enter nb ~ when you hit the space-bar fish will replace nb with nikola bulid. This makes them more transparent than functions, although they're also less powerful.

According to this github issue the files you put into conf.d/ get read before config.fish so whatever you put in there is usable in config.fish (and using config.fish) at all is optional.

Nikola

Abbreviations to hopefully make working with Nikola a little quicker.

abbr --add -- n "nikola"

New Posts and Pages

I only use org-mode so these are the commands to make new posts and pages.

abbr --add -- post nikola new_post --format orgmode --title
abbr --add -- page nikola new_page --format orgmode --title

They actually look like the same files are produced, just one gets put into your pages folder and one gets put into your posts folder. Which is nice, I guess, in that we can move things back and forth between the blog and the web-pages as we need to.

Build, Serve, and Develop

These are the ones I use the most when making posts and pages.

abbr --add -- nb "nikola build"
abbr --add -- nbs 'nikola build; nikola serve'
abbr --add -- nauto "nikola auto"

auto will build and reload the page for you anytime it sees any changes. This can be convenient sometimes, but sometimes it detects changes to often (maybe when something is making a temporary backup) and it can end up reloading while you're reading the page so I don't use it as much as I used to.

Deploy to Github

And once it's ready…

abbr --add -- deploy "nikola github_deploy"

Git

abbr --add -- g "git"

Add, Commit, Push Stuff

Adding Files

abbr --add -- add "git add"
abbr --add -- gaa "git add -A"

Are you ready for a commitment?

abbr --add -- commit "git commit"
abbr --add -- gcm "git commit --message"
abbr --add -- amend "git commit --amend"

Speak To The Gods On High

sync is a builtin command (it writes caches to disk) so I went with gsync for the abbreviation.

abbr --add -- push "git push"
abbr --add -- gsy "legit sync"
abbr --add -- publish "legit publish"
abbr --add -- fetch "git fetch --prune"

The State of Things

status gives you information about the fish-shell. This is the only thing I ever see, though.

status
This is not a login shell
Job control: Only on interactive jobs

But, anyway, I went with gstat to not block it in case it's really needed at some point.

Note: Look at the SSH Agent Config Fragment post to see status in use. It's probably meant for programming, not as a command-line command.

abbr --add -- state "git status -sb"
abbr --add -- gstat "git status"

Branch Work

switch is a built-in fish command to conditionally decide what to execute (like a chain of if-else statements).

abbr --add -- branches "legit branches"
abbr --add -- branch "legit switch"
abbr --add -- brls "git ls-tree --name-only -r"
abbr --add -- brlog "git log --oneline --abbrev-commit" \
    " --all --graph --decorate --color"
abbr --add -- brlogall "git log --branches --graph"
abbr --add -- renamebranch "git branch -m"
abbr --add -- merge "git merge"
abbr --add -- cob "git checkout -b"
abbr --add -- destroy "git branch -d"
abbr --add -- destroythegods "git push origin -d"

Checkout Files

abbr --add -- usetheirs "git checkout --theirs"
abbr --add -- useours "git checkout --ours"

My, How Things Have Changed

abbr --add -- codechanges "git log -p"
abbr --add -- logdiff "git log -p"
abbr --add -- gdiff "git diff"
abbr --add -- gdiffn "git diff --name-status"

Pass

For pass the password-manager. I was doing the pull and push commands but decided to use the git sync alias which is actuall calling legit sync, which I think does pretty much the same as what I was doing. It does other stuff like stashing uncommitted changes, but that should never happen when using pass. Anyway. Sync.

abbr --add -- p "pass"
abbr --add -- pgs "pass git sync"

Grep

abbr --add -- grepr "grep --color=always"

Proton VPN

abbr --add -- vdc "protonvpn-cli disconnect; protonvpn-cli connect"
abbr --add -- fastestvpn "protonvpn-cli disconnect;protonvpn-cli connect --fastest; protonvpn-cli status"

Rsync

Rsyncer

abbr --add -- rsyncer "rsync --progress --archive --compress"

Rsyncerd

abbr --add -- rsyncerd "rsync --progress --archive --compress --delete"

Rsyncerf

Creates the folder structure but doesn't copy the files over.

abbr --add -- rsyncerf 'rsync --progress --archive --delete --include="*/" --exclude="*"'

Rsyncery

Does a dry-run to show what would be done without actually transferring files. I made this because for some reason the Raspeberry Pi with Debian 11 on it has some kind of bug that makes rsync fail if the transfers take too long. I don't really know the cause, but it doesn't happen with newer ubuntu versions so it seem like either it's a bug in the creation of the LUKs drive (since I'm creating it on the Raspberry Pi) or in the running of rsync (when the error actually occurs), but in either case, I sometimes need to do sub-folders one at a time instead of just syncing the top folder in order to keep the transfers shorter and running this lets me see what folders need to be synced.

abbr --add -- drysync "rsync --verbose --archive --delete --dry-run"

Links

Rsync

  • Server Fault: Answer explaining the --archive option (I was using it before but also adding other flags that were redundant to it).
  • Server Fault answer: explaining how to create the folder structure but not copy the files.