Refactor zsh plugins

- Remove fzf-tab.
- Configure zsh-abbr with Home Manager.
This commit is contained in:
Oliver Davies 2025-01-16 17:03:56 +00:00
parent fed99ed659
commit 4f3c713f73
3 changed files with 157 additions and 164 deletions

View file

@ -6,6 +6,12 @@
enableCompletion = true; enableCompletion = true;
syntaxHighlighting.enable = true; syntaxHighlighting.enable = true;
zsh-abbr = {
enable = true;
abbreviations = import ./zsh/abbreviations.nix;
};
cdpath = [ "~/Code" ]; cdpath = [ "~/Code" ];
dotDir = ".config/zsh"; dotDir = ".config/zsh";
@ -55,16 +61,5 @@
setopt pushd_ignore_dups setopt pushd_ignore_dups
setopt pushdminus setopt pushdminus
''; '';
zplug = {
enable = true;
plugins = [
{ name = "Aloxaf/fzf-tab"; }
{ name = "olets/zsh-abbr"; }
];
};
}; };
home.file.".config/zsh-abbr/user-abbreviations".text = builtins.readFile ./zsh/abbreviations.zsh;
} }

View file

@ -0,0 +1,151 @@
{
cl = "clear";
cs = "create-script";
daily = "run create-daily next";
rst = "rst2pdf";
st = "source .tmux";
sz = "source ~/.config/zsh/.zshrc";
ti = "timer";
uagr = "update-all-git-repos";
v = "nvim";
yt = "yt-dlp";
evl = "export-video-list";
vv = "cat ~/Documents/videos.json";
g = "git";
ga = "git add";
gan = "git add -N";
gap = "git add -p";
gb = "git branch";
gbl = "git blame";
gc = "git commit";
gca = "git commit --amend";
gcan = "git commit --amend --no-edit";
gcl = "git clone";
gcm = "git commit -m";
gco = "git checkout";
gcob = "git checkout -b";
gd = "git diff";
gds = "git diff --staged";
gf = "git fetch";
gfa = "git fetch --all";
gl = "git log";
glo = "git log --oneline";
gls = "git log --stat";
gm = "git merge";
gmf = "git merge --ff";
gmnf = "git merge --no-ff";
gp = "git push";
gpa = "git push acquia";
gpam = "git push acquia main";
gpap = "git push acquia HEAD:production";
gpl = "git pull";
gplr = "git pull --rebase";
gpo = "git push origin";
gpom = "git push origin main";
gr = "git rebase";
gra = "git rebase --abort";
grc = "git rebase --continue";
gri = "git rebase -i";
gs = "git status";
gsh = "git show";
gst = "git stash";
gstp = "git stash pop";
# tmux
ta = "tmux attach";
tl = "tmux list-sessions";
tk = "tmux kill-session";
# Docker and Docker Compose.
dk = "docker";
dkp = "docker ps";
dkpa = "docker ps -a";
dkpaq = "docker ps -a -q";
dkb = "docker build -t";
dks = "docker start";
dkt = "docker stop";
dkrm = "docker rm";
dkri = "docker rmi";
dke = "docker exec -ti";
dkl = "docker logs -f";
dki = "docker images";
dkpu = "docker pull";
dkph = "docker push";
dkbnc = "docker build --no-cache -t";
dkr = "docker run --rm";
dkrti = "docker run --rm -ti";
dkc = "docker compose";
dkcb = "docker compose build";
dkcu = "docker compose up";
dkclean = "docker ps -q -a -f status=exited | xargs -r docker rm && docker images -q -f dangling=true | xargs -r docker rmi";
# Nix and direnv.
dea = "direnv allow";
dee = "direnv edit";
nxf = "nix flake";
nxfc = "nix flake check";
nxfs = "nix flake show";
nxfu = "nix flake update";
nxr = "nix run nixpkgs#%";
nxs = "nix shell nixpkgs#%";
# run scripts.
r = "run";
rc = "run composer";
rcda = "run composer dump-autoload";
rci = "run composer install";
rcr = "run composer require";
rcu = "run composer update";
rd = "run drush";
rdce = "run drush config:export -y";
rdci = "run drush config:import -y";
rdcr = "run drush cache:rebuild";
rdscr = "run drush php:script";
rduli = "run drush uli";
rdup = "run drush updatedb -y";
rpub = "run publish";
rt = "run test";
"-g A1" = "| awk '{print $1}'";
"-g C" = "| xclip -sel clip";
"-g Fj" = "| jq .";
"-g Fy" = "| yq .";
"-g G" = "| grep";
"-g GH" = "| grep HTTP";
"-g Gi" = "| grep -i";
"-g H2" = "| head -n 20";
"-g H" = "| head";
"-g L" = "| less";
"-g V" = "| nvim -";
"-g X" = "| xargs -I1";
nah = "git reset --hard; git clean -fd";
wip = "git commit -m wip";
dv = "devenv";
dvi = "devenv info";
dvp = "devenv processes";
dvs = "devenv shell";
dvt = "devenv tasks";
dvu = "devenv up";
c = "composer";
cr = "composer require";
crd = "composer require drupal/%";
cu = "composer update";
cul = "composer update --lock";
cw = "composer why";
cwn = "composer why-not";
d = "drush";
dce = "drush config:export -y";
dci = "drush config:import -y";
dcr = "drush cache:rebuild";
den = "drush pm:enable -y";
deu = "drush pm:uninstall";
dscr = "drush php:script";
duli = "drush uli";
dup = "drush updatedb -y";
}

View file

@ -1,153 +0,0 @@
abbr cl="clear"
abbr cs="create-script"
abbr daily="run create-daily next"
abbr rst="rst2pdf"
abbr st="source .tmux"
abbr sz="source ~/.config/zsh/.zshrc"
abbr ti="timer"
abbr uagr="update-all-git-repos"
abbr v="nvim"
abbr yt="yt-dlp"
abbr evl="export-video-list"
abbr vv="cat ~/Documents/videos.json"
abbr g="git"
abbr ga="git add"
abbr gan="git add -N"
abbr gap="git add -p"
abbr gb="git branch"
abbr gbl="git blame"
abbr gc="git commit"
abbr gca="git commit --amend"
abbr gcan="git commit --amend --no-edit"
abbr gcl="git clone"
abbr gcm="git commit -m"
abbr gco="git checkout"
abbr gcob="git checkout -b"
abbr gd="git diff"
abbr gds="git diff --staged"
abbr gf="git fetch"
abbr gfa="git fetch --all"
abbr gl="git log"
abbr glo="git log --oneline"
abbr gls="git log --stat"
abbr gm="git merge"
abbr gmf="git merge --ff"
abbr gmnf="git merge --no-ff"
abbr gp="git push"
abbr gpa="git push acquia"
abbr gpam="git push acquia main"
abbr gpap="git push acquia HEAD:production"
abbr gpl="git pull"
abbr gplr="git pull --rebase"
abbr gpo="git push origin"
abbr gpom="git push origin main"
abbr gr="git rebase"
abbr gra="git rebase --abort"
abbr grc="git rebase --continue"
abbr gri="git rebase -i"
abbr gs="git status"
abbr gsh="git show"
abbr gst="git stash"
abbr gstp="git stash pop"
# tmux
abbr ta="tmux attach"
abbr tl="tmux list-sessions"
abbr tk="tmux kill-session"
# Docker and Docker Compose.
abbr dk="docker"
abbr dkp="docker ps"
abbr dkpa="docker ps -a"
abbr dkpaq="docker ps -a -q"
abbr dkb="docker build -t"
abbr dks="docker start"
abbr dkt="docker stop"
abbr dkrm="docker rm"
abbr dkri="docker rmi"
abbr dke="docker exec -ti"
abbr dkl="docker logs -f"
abbr dki="docker images"
abbr dkpu="docker pull"
abbr dkph="docker push"
abbr dkbnc="docker build --no-cache -t"
abbr dkr="docker run --rm"
abbr dkrti="docker run --rm -ti"
abbr dkc="docker compose"
abbr dkcb="docker compose build"
abbr dkcu="docker compose up"
abbr dkclean="docker ps -q -a -f status=exited | xargs -r docker rm && docker images -q -f dangling=true | xargs -r docker rmi"
# Nix and direnv.
abbr dea="direnv allow"
abbr dee="direnv edit"
abbr nxf="nix flake"
abbr nxfc="nix flake check"
abbr nxfs="nix flake show"
abbr nxfu="nix flake update"
abbr nxr="nix run nixpkgs#%"
abbr nxs="nix shell nixpkgs#%"
# run scripts.
abbr r="run"
abbr rc="run composer"
abbr rcda="run composer dump-autoload"
abbr rci="run composer install"
abbr rcr="run composer require"
abbr rcu="run composer update"
abbr rd="run drush"
abbr rdce="run drush config:export -y"
abbr rdci="run drush config:import -y"
abbr rdcr="run drush cache:rebuild"
abbr rdscr="run drush php:script"
abbr rduli="run drush uli"
abbr rdup="run drush updatedb -y"
abbr rpub="run publish"
abbr rt="run test"
abbr -g A1="| awk '{print $1}'"
abbr -g C="| xclip -sel clip"
abbr -g Fj="| jq ."
abbr -g Fy="| yq ."
abbr -g G="| grep"
abbr -g GH="| grep HTTP"
abbr -g Gi="| grep -i"
abbr -g H2="| head -n 20"
abbr -g H="| head"
abbr -g L="| less"
abbr -g V="| nvim -"
abbr -g X="| xargs -I1"
abbr today="task +TODAY"
abbr tomorrow="task +TOMORROW"
abbr overdue="task +OVERDUE"
abbr nah="git reset --hard; git clean -fd"
abbr wip="git commit -m wip"
abbr dv="devenv"
abbr dvi="devenv info"
abbr dvp="devenv processes"
abbr dvs="devenv shell"
abbr dvt="devenv tasks"
abbr dvu="devenv up"
abbr c="composer"
abbr cr="composer require"
abbr crd="composer require drupal/%"
abbr cu="composer update"
abbr cul="composer update --lock"
abbr cw="composer why"
abbr cwn="composer why-not"
abbr d="drush"
abbr dce="drush config:export -y"
abbr dci="drush config:import -y"
abbr dcr="drush cache:rebuild"
abbr den="drush pm:enable -y"
abbr deu="drush pm:uninstall"
abbr dscr="drush php:script"
abbr duli="drush uli"
abbr dup="drush updatedb -y"