zsh: extract aliases and abbreviations into
...separate files
This commit is contained in:
parent
0ec273cbb4
commit
b68d48603e
|
@ -6,21 +6,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
|
||||||
# Aliases (which don't expand).
|
shellAliases = (import ./zsh/aliases.nix);
|
||||||
shellAliases = {
|
|
||||||
"-" = "cd -";
|
|
||||||
".." = "cd ..";
|
|
||||||
"..." = "cd ../..";
|
|
||||||
"...." = "cd ../../..";
|
|
||||||
"....." = "cd ../../../..";
|
|
||||||
cat = "bat";
|
|
||||||
run = "./run";
|
|
||||||
s = "secrets";
|
|
||||||
secrets = ''doppler --project "$(whoami)" run'';
|
|
||||||
tag = "tag-release";
|
|
||||||
wt = "git worktree";
|
|
||||||
vss = "LC_ALL=C sort --unique ~/Code/personal/opdavies.nvim/spell/en.utf-8.add --output ~/Code/personal/opdavies.nvim/spell/en.utf-8.add";
|
|
||||||
};
|
|
||||||
|
|
||||||
initExtra = ''
|
initExtra = ''
|
||||||
git() {
|
git() {
|
||||||
|
@ -138,69 +124,20 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".config/zsh-abbr/user-abbreviations".text = ''
|
home.file.".config/zsh-abbr/user-abbreviations".text = builtins.readFile ./zsh/abbreviations.zsh;
|
||||||
abbr dea="direnv allow"
|
|
||||||
abbr dee="direnv edit"
|
|
||||||
abbr cs="create-script"
|
|
||||||
abbr daily="run create-daily next"
|
|
||||||
abbr switch="run nixos nixedo switch"
|
|
||||||
abbr sz="source ~/.config/zsh/.zshrc"
|
|
||||||
|
|
||||||
abbr g="git"
|
home.sessionVariables = {
|
||||||
abbr ga="git add"
|
AUTO_NOTIFY_IGNORE = builtins.concatStringsSep " " [
|
||||||
abbr gap="git add -p"
|
"git commit"
|
||||||
abbr gc="git commit"
|
"htop"
|
||||||
abbr gri="git rebase -i"
|
"less"
|
||||||
abbr gs="git status"
|
"man"
|
||||||
|
"more"
|
||||||
# tmux
|
"nix develop"
|
||||||
abbr ta="tmux attach"
|
"nvim"
|
||||||
abbr tl="tmux list-sessions"
|
"ssh"
|
||||||
abbr tk="tmux kill-session"
|
"tldr"
|
||||||
|
"watch"
|
||||||
# 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"
|
|
||||||
|
|
||||||
# run scripts.
|
|
||||||
abbr r="run"
|
|
||||||
abbr rc="run composer"
|
|
||||||
abbr rd="run drush"
|
|
||||||
abbr rdcr="run drush cr"
|
|
||||||
abbr rdup="run drush updb -y"
|
|
||||||
abbr rdce="run drush config:export -y"
|
|
||||||
abbr rdci="run drush config:import -y"
|
|
||||||
abbr rduli="run drush uli"
|
|
||||||
|
|
||||||
abbr -g A1="| awk '{print $1}'"
|
|
||||||
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="| vim -"
|
|
||||||
abbr -g X="| xargs -I1"
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
63
lib/shared/modules/zsh/abbreviations.zsh
Normal file
63
lib/shared/modules/zsh/abbreviations.zsh
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
abbr dea="direnv allow"
|
||||||
|
abbr dee="direnv edit"
|
||||||
|
abbr cs="create-script"
|
||||||
|
abbr daily="run create-daily next"
|
||||||
|
abbr switch="run nixos nixedo switch"
|
||||||
|
abbr sz="source ~/.config/zsh/.zshrc"
|
||||||
|
|
||||||
|
abbr g="git"
|
||||||
|
abbr ga="git add"
|
||||||
|
abbr gap="git add -p"
|
||||||
|
abbr gc="git commit"
|
||||||
|
abbr gri="git rebase -i"
|
||||||
|
abbr gs="git status"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
# run scripts.
|
||||||
|
abbr r="run"
|
||||||
|
abbr rc="run composer"
|
||||||
|
abbr rd="run drush"
|
||||||
|
abbr rdcr="run drush cr"
|
||||||
|
abbr rdup="run drush updb -y"
|
||||||
|
abbr rdce="run drush config:export -y"
|
||||||
|
abbr rdci="run drush config:import -y"
|
||||||
|
abbr rduli="run drush uli"
|
||||||
|
|
||||||
|
abbr -g A1="| awk '{print $1}'"
|
||||||
|
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="| vim -"
|
||||||
|
abbr -g X="| xargs -I1"
|
14
lib/shared/modules/zsh/aliases.nix
Normal file
14
lib/shared/modules/zsh/aliases.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"-" = "cd -";
|
||||||
|
".." = "cd ..";
|
||||||
|
"..." = "cd ../..";
|
||||||
|
"...." = "cd ../../..";
|
||||||
|
"....." = "cd ../../../..";
|
||||||
|
cat = "bat";
|
||||||
|
run = "./run";
|
||||||
|
s = "secrets";
|
||||||
|
secrets = ''doppler --project "$(whoami)" run'';
|
||||||
|
tag = "tag-release";
|
||||||
|
wt = "git worktree";
|
||||||
|
vss = "LC_ALL=C sort --unique ~/Code/personal/opdavies.nvim/spell/en.utf-8.add --output ~/Code/personal/opdavies.nvim/spell/en.utf-8.add";
|
||||||
|
}
|
Loading…
Reference in a new issue