Nixify fish configuration

This isn't 100% usable, but it works. You can build it with `nix-env` and then
run it with `wpcarros-fish`.
This commit is contained in:
William Carroll 2020-01-06 14:54:26 +00:00
parent 73e988c298
commit 7175d230c2
4 changed files with 500 additions and 31 deletions

View file

@ -52,6 +52,9 @@
# TODO: Decide if I prefer `abbr` or `alias` for fish. `abbr` is a new concept
# for me.
# Remove the default greeting from fish
set fish_greeting ""
function nix_find
nix-build '<nixpkgs>' --no-build-output -A $argv[1]
end
@ -77,12 +80,21 @@ function fish_prompt
echo -e "\n$suffix "
end
# 64812159184761958540
# Setup fzf for fuzzily finding commands, files, directories
source (fzf-share)/key-bindings.fish && fzf_key_bindings
# Setup autojump for a frequency-based alternative to cd.
# TODO: Debug why I couldn't get `fasd` to work with Nix and fish.
source (nix_find autojump)/share/autojump/autojump.fish
# TODO: What is the difference between `source` and `eval`
# direnv
source (direnv hook fish)
# Miscellaneous
abbr --add c xclip -selection clipboard -i
abbr --add p xclip -selection clipboard -o
# TODO: Depend on `cp_dwim`.
abbr --add cp cp_dwim
abbr --add lorem echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
@ -90,9 +102,13 @@ abbr --add lorem echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit,
abbr --add e emacsclient --no-wait --create-frame
abbr --add cat bat --theme=TwoDark
abbr --add j fasd_cd -d # Use j to emulate autojump; my muscle memory is hardened here
# TODO: Support this once `fasd` works.
# abbr --add j fasd_cd -d # Use j to emulate autojump; my muscle memory is hardened here
abbr --add vim nvim
# TODO: Support `blutetoothctl` with Nix.
abbr --add btctl bluetoothctl
abbr --add rg rg --ignore-case
abbr --add rgh rg --hidden # By default, rg skips hidden files
abbr --add fdh fd --hidden # By default, rg skips hidden files
@ -108,26 +124,30 @@ abbr --add stopx sudo service lightdm stop # stop X server session
abbr --add please 'eval sudo $history[1]'
abbr --add plz please
# TODO: Consider packaging this with Nix.
abbr --add simple_vim vim -u ~/.config/nvim/simple.vim # vim without a zero-dependency vimrc
# TODO: Package this with Nix.
abbr --add simple_vim vim -u ~/.config/nvim/simple.vim
# Filesystem
# TODO: Depend on `mkdir_cd`.
abbr --add mdd mkdir_cd
abbr --add mdp mkdir --parents
abbr --add ls exa --sort=type
abbr --add ll exa --long --sort=type
abbr --add la exa --long --all --sort=type
# TODO: Depend on these functions once they're defined.
abbr --add files laf
abbr --add dirs lad
abbr --add dirs lad
abbr --add links lal
# Device and power management
abbr --add off shutdown now
abbr --add suspend systemctl suspend
abbr --add off shutdown now
abbr --add suspend systemctl suspend
abbr --add hibernate systemctl hibernate
abbr --add pscp pass show --clip
# TODO: Debug `Error: No interface specified.`.
abbr --add wfls nmcli device wifi
abbr --add wfls nmcli device connect
@ -138,20 +158,20 @@ abbr --add td tmux detach
# Chrome
abbr --add chrome google-chrome
abbr --add cssh chrome --app-id=pnhechapfaindjhompbnflcldabbghjo # Secure Shell
abbr --add crd chrome --app-id=gbchcmhmhahfdphkhkmpfmihenigjmpp # Chrome Remote Desktop
abbr --add cssh chrome --app-id=pnhechapfaindjhompbnflcldabbghjo # Secure Shell
abbr --add crd chrome --app-id=gbchcmhmhahfdphkhkmpfmihenigjmpp # Chrome Remote Desktop
# Dropbox
abbr --add drst dropbox.py status
# Docker
abbr --add dk docker
abbr --add dkps docker ps
abbr --add dk docker
abbr --add dkps docker ps
abbr --add dkpsa docker ps -a
abbr --add dkrm docker rm
abbr --add dkrm docker rm
abbr --add dkrmi docker rmi
abbr --add dkrd docker run -d
abbr --add dki docker images
abbr --add dkrd docker run -d
abbr --add dki docker images
# Java
# TODO: Consider packaging this idea with Nix instead
@ -166,6 +186,7 @@ abbr --add tism MIX_ENV=test iex -S mix
abbr --add mdg mix deps.get
abbr --add mdu mix deps.update
abbr --add mdup mix docker.up
# TODO: Support `repl_ex` and company as Nix-built programs.
abbr --add repl_ex dkish elixir iex
# Clojure
@ -173,8 +194,8 @@ abbr --add cljsh dkish clojure lein repl
# GPG
abbr --add gpged gpg --edit-key wpcarro@gmail.com
abbr --add gpge gpg --encrypt
abbr --add gpgd gpg --decrypt
abbr --add gpge gpg --encrypt
abbr --add gpgd gpg --decrypt
abbr --add gpgls gpg --list-keys
# Git
@ -206,28 +227,29 @@ abbr --add gst 'git status && hub pr list'
# Mercurial counterparts. Some may map 1:1, others may be like putting a square
# peg into a round hole. I will try and use my best judgement in these cases
# while erring on the side of unifying the two APIs.
abbr --add hgst PAGER="" hg status
abbr --add hglp hg xl
abbr --add hgp hg uploadchain # this is like `git push`
abbr --add hga hg add
abbr --add hgc hg commit
abbr --add hgst PAGER="" hg status
abbr --add hglp hg xl
abbr --add hgp hg uploadchain # this is like `git push`
abbr --add hga hg add
abbr --add hgc hg commit
abbr --add hgcan hg amend # like `git commit --amend --no-edit'
abbr --add hgpr hg mail -r . -m # this may be similar to `hub pull-request`
abbr --add hgd hg diff
abbr --add hgsh hg export
abbr --add hgco hg update
abbr --add hgls hg citc --list # should have different output from `pils`
abbr --add hgrc hg rebase --continue
abbr --add hgra hg rebase --abort
abbr --add hgpr hg mail -r . -m # this may be similar to `hub pull-request`
abbr --add hgd hg diff
abbr --add hgsh hg export
abbr --add hgco hg update
abbr --add hgls hg citc --list # should have different output from `pils`
abbr --add hgrc hg rebase --continue
abbr --add hgra hg rebase --abort
abbr --add hgrm hg citc -d # delete a CitC client created with Fig
abbr --add hgconflicts hg resolve --list 'set:unresolved()' # much like `gconflicts`
abbr --add hgrm hg citc -d # delete a CitC client created with Fig
# Haskell
abbr --add sb stack build
abbr --add se stack exec --
abbr --add sc stack clean
# alias st="stack test" # blocks suckless-terminal
abbr --add st stack test
abbr --add haddocks open (stack path --local-doc-root)/index.html
# TODO: Remove `dkish` in favor of a Nix-built solution.
abbr --add hksh 'dkish haskell ghci'
# Kubernetes
@ -240,6 +262,8 @@ abbr --add kedit kubectl edit deployments
abbr --add kswitch gcloud container clusters get-credentials
# Nix
# TODO: Ensure that this depends on `nix_introspect` as defined in
# functions.fish.
abbr --add nq nix_introspect
abbr --add nsh nix-shell
abbr --add nshp nix-shell --pure
@ -250,7 +274,7 @@ abbr --add nls nix-env --query
abbr --add nrs sudo nixos-rebuild switch
# Aptitude (apt)
abbr --add apti sudo apt-get install --assume-yes
abbr --add apti sudo apt-get install --assume-yes
abbr --add aptrm sudo apt remove
# Pacman