From c0810fd98e47ad0db2d438df28afc4d525ca4f33 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Mon, 8 May 2023 14:18:38 -0400 Subject: [PATCH] nix: Add fish abbreviations I originally wasn't going to mix logic from my dotfiles with NixOS, however I was unable to simply use my abbreviations after adding ~/.config/fish/config.fish, so I decided to give it a try. Using Nix to manage fish abbreviations feels nicer than using a config.fish because I am now easily able to manipulate these abbreviations with the limitless possibilities of the Nix language, and with the guarantee that the output is reproducible. --- configuration.nix | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/configuration.nix b/configuration.nix index bfc03d1..1af96bf 100644 --- a/configuration.nix +++ b/configuration.nix @@ -19,6 +19,85 @@ programs.fish.enable = true; users.defaultUserShell = pkgs.fish; environment.shells = with pkgs; [ fish ]; + programs.fish.shellAbbrs = { + g = "git"; + ga = "git add"; + gaa = "git add --all"; + gap = "git add --patch"; + gb = "git branch"; # List all branches + gc = "git commit -m"; + gca = "git commit --amend"; + gcl = "git clone"; + gco = "git checkout"; + gd = "git diff"; # Show all file changes not staged yet + gdi = "git difftool --no-symlinks --dir-diff"; + gds = "git diff --staged"; # Show changes staged but not committed + gdsi = "git difftool --no-symlinks --dir-diff --staged"; + gi = "git init"; + gl = "git log --oneline --decorate --all --graph -n 10"; + gm = "git merge"; + gp = "git push"; # Push your commits to a remote server + gr = "git reset HEAD~"; # Undo the last commit but keep changed files + gra = "git remote add"; + gre = "git remote --verbose"; # List all remotes + grh = "git reset HEAD"; + grr = + "git reset --hard HEAD~"; # Remove the last commit and all changes with it + gs = "git status"; + gst = "git stash"; + gstp = "git stash pop"; + gt = "git tag"; + gts = "git tag -s"; + + d = "sudo docker"; + dc = "sudo docker-compose"; + dcu = "sudo docker-compose up"; + dcd = "sudo docker-compose down"; + dcp = "sudo docker-compose pull"; + dcl = "sudo docker-compose logs"; + + y = "yarn"; + ya = "yarn add"; + yar = "yarn remove"; + yi = "yarn init"; + yin = "yarn install"; + yu = "yarn upgrade-interactive"; + + v = "vagrant"; + vu = "vagrant up"; + vh = "vagrant halt"; + vs = "vagrant ssh"; + vp = "vagrant provision"; + + dl = "yt-dlp"; + vol = + "amixer set 'Master'"; # Change the volume, e.g. vol 10%+, vol 10%-, vol 100% + copy = "xclip -sel clip <"; # Easily copy the contents of any file + cf = "tput reset"; # Clear the terminal completely + nf = + "tput reset; and neofetch --size 56%; and xdotool key --delay 100 Ctrl+Shift+Page_Up"; + df = "df --human-readable --type=ext4 --total"; + du = "du --human-readable --summarize"; + jis = + "recode shift_jis..utf8"; # Easily convert shift_jis-encoded files to utf8 + utf16 = + "recode utf16..utf8"; # Rarely, some files from Japan are utf16 instead + jp = "LANG=ja_JP.UTF-8 LC_ALL=ja_JP.UTF-8"; + + a = "ansible-playbook"; + b = "feh --bg-fill"; # Change the background + c = "clear"; # Because 5 letters is too much + e = "exit"; + k = "kitty @ set-colors -c -a ~/.cache/wal/kitty"; + l = "ls -l"; + p = "paru"; + r = "ranger"; + w = "wal -o ~/.config/wal/done.sh"; + T = "tree"; + + nano = "vim"; # The explanation is in the name + emacs = "vim"; # No need to start another operating system + }; time.timeZone = "America/New_York";