diff --git a/abbreviations/README.md b/abbreviations/README.md new file mode 100644 index 00000000..ee0808cd --- /dev/null +++ b/abbreviations/README.md @@ -0,0 +1,9 @@ +# Custom abbreviations + +This current directory provides custom abbreviations. They can be used by importing their exported abbreviations via: + +```nushell +source path/to//-abbreviations.nu +``` + +With `path/to/` being either the relative path of the file to your current working directory or its absolute path. diff --git a/abbreviations/bat/bat-abbreviations.nu b/abbreviations/bat/bat-abbreviations.nu new file mode 100644 index 00000000..6c07fca0 --- /dev/null +++ b/abbreviations/bat/bat-abbreviations.nu @@ -0,0 +1,9 @@ +$env.config.abbreviations = { + ...$env.config.abbreviations + b: "bat" + bn: "bat --number" + bnl: "bat --number --line-range" + bp: "bat --plain" + bpl: "bat --plain --line-range" + bl: "bat --line-range" +} diff --git a/abbreviations/chezmoi/chezmoi-abbreviations.nu b/abbreviations/chezmoi/chezmoi-abbreviations.nu new file mode 100644 index 00000000..cf98ce1d --- /dev/null +++ b/abbreviations/chezmoi/chezmoi-abbreviations.nu @@ -0,0 +1,8 @@ +$env.config.abbreviations = { + ch: "chezmoi" + chad: "chezmoi add" + chap: "chezmoi apply" + chd: "chezmoi diff" + chda: "chezmoi data" + chs: "chezmoi status" +} diff --git a/abbreviations/docker/README.md b/abbreviations/docker/README.md new file mode 100644 index 00000000..6fb5ee69 --- /dev/null +++ b/abbreviations/docker/README.md @@ -0,0 +1,45 @@ +# docker abbreviations in nushell + +This plugin adds the following abbreviations: + +| Abbreviation | Command | Description | +| ------------ | --------------------------------- | ---------------------------------------------------------------------------------------- | +| dbl | docker build | Build an image from a Dockerfile | +| dcin | docker container inspect | Display detailed information on one or more containers | +| dcls | docker container ls | List all the running docker containers | +| dclsa | docker container ls -a | List all running and stopped containers | +| dib | docker image build | Build an image from a Dockerfile (same as docker build) | +| dii | docker image inspect | Display detailed information on one or more images | +| dils | docker image ls | List docker images | +| dipu | docker image push | Push an image or repository to a remote registry | +| dirm | docker image rm | Remove one or more images | +| dit | docker image tag | Add a name and tag to a particular image | +| dlo | docker container logs | Fetch the logs of a docker container | +| dnc | docker network create | Create a new network | +| dncn | docker network connect | Connect a container to a network | +| dndcn | docker network disconnect | Disconnect a container from a network | +| dni | docker network inspect | Return information about one or more networks | +| dnls | docker network ls | List all networks the engine daemon knows about, including those spanning multiple hosts | +| dnrm | docker network rm | Remove one or more networks | +| dpo | docker container port | List port mappings or a specific mapping for the container | +| dpu | docker pull | Pull an image or a repository from a registry | +| dr | docker container run | Create a new container and start it using the specified command | +| drit | docker container run -it | Create a new container and start it in an interactive shell | +| drm | docker container rm | Remove the specified container(s) | +| drm! | docker container rm -f | Force the removal of a running container (uses SIGKILL) | +| dst | docker container start | Start one or more stopped containers | +| drs | docker container restart | Restart one or more containers | +| dstp | docker container stop | Stop one or more running containers | +| dtop | docker top | Display the running processes of a container | +| dvi | docker volume inspect | Display detailed information about one or more volumes | +| dvls | docker volume ls | List all the volumes known to docker | +| dvprune | docker volume prune | Cleanup dangling volumes | +| dxc | docker container exec | Run a new command in a running container | +| dxcit | docker container exec -it | Run a new command in a running container in an interactive shell | +| dsta | docker ps -q \| xargs docker stop | Stop all running containers | + +## install + + ```nushell + source {project_path}/abbreviations/docker/docker.nu + ``` diff --git a/abbreviations/docker/docker-abbreviations.nu b/abbreviations/docker/docker-abbreviations.nu new file mode 100644 index 00000000..e4ada07c --- /dev/null +++ b/abbreviations/docker/docker-abbreviations.nu @@ -0,0 +1,35 @@ +$env.config.abbreviations = { + dbl: "docker build" + dcin: "docker container inspect" + dcls: "docker container ls" + dclsa: "docker container ls -a" + dib: "docker image build" + dii: "docker image inspect" + dils: "docker image ls" + dipu: "docker image push" + dirm: "docker image rm" + dit: "docker image tag" + dlo: "docker container logs" + dnc: "docker network create" + dncn: "docker network connect" + dndcn: "docker network disconnect" + dni: "docker network inspect" + dnls: "docker network ls" + dnrm: "docker network rm" + dpo: "docker container port" + dpu: "docker pull" + dr: "docker container run" + drit: "docker container run -it" + drm: "docker container rm" + drm!: "docker container rm -f" + dst: "docker container start" + dsta: "docker ps -q | xargs docker stop" + drs: "docker container restart" + dstp: "docker container stop" + dtop: "docker top" + dvi: "docker volume inspect" + dvls: "docker volume ls" + dvprune: "docker volume prune" + dxc: "docker container exec" + dxcit: "docker container exec -it" +} diff --git a/abbreviations/exa/exa-abbreviations.nu b/abbreviations/exa/exa-abbreviations.nu new file mode 100644 index 00000000..14631907 --- /dev/null +++ b/abbreviations/exa/exa-abbreviations.nu @@ -0,0 +1,8 @@ +$env.config.abbreviations = { + x: "exa --icons" + xa: "exa --icons --all" + xl: "exa --long" + xla: "exa --long --all" + xt: "exa --icons --tree" + xta: "exa --icons --tree --all" +} diff --git a/abbreviations/eza/eza-abbreviations.nu b/abbreviations/eza/eza-abbreviations.nu new file mode 100644 index 00000000..5be3580a --- /dev/null +++ b/abbreviations/eza/eza-abbreviations.nu @@ -0,0 +1,8 @@ +$env.config.abbreviations = { + x: "eza --icons" + xa: "eza --icons --all" + xl: "eza --long" + xla: "eza --long --all" + xt: "eza --icons --tree" + xta: "eza --icons --tree --all" +} diff --git a/abbreviations/git/git-abbreviations.nu b/abbreviations/git/git-abbreviations.nu new file mode 100644 index 00000000..f53ea05a --- /dev/null +++ b/abbreviations/git/git-abbreviations.nu @@ -0,0 +1,188 @@ +# returns the name of the current branch +export def git_current_branch [] { + ^git rev-parse --abbrev-ref HEAD +} + +export def git_main_branch [] { + git remote show origin + | lines + | str trim + | find --regex 'HEAD .*?[:: ].+' + | first + | ansi strip + | str replace --regex 'HEAD .*?[:: ]\s*(.+)' '$1' +} + +# +# Abbreviations +# (sorted alphabetically) +# + +$env.config.abbreviations = { + ...$env.config.abbreviations + ga: "git add" + gaa: "git add --all" + gapa: "git add --patch" + gau: "git add --update" + gav: "git add --verbose" + gap: "git apply" + gapt: "git apply --3way" + gb: "git branch" + gba: "git branch --all" + gbd: "git branch --delete" + gbD: "git branch --delete --force" + gbl: "git blame -b -w" + gbm: "git branch --move" + gbmc: "git branch --move (git_current_branch)" + gbnm: "git branch --no-merged" + gbr: "git branch --remote" + gbs: "git bisect" + gbsb: "git bisect bad" + gbsg: "git bisect good" + gbsn: "git bisect new" + gbso: "git bisect old" + gbsr: "git bisect reset" + gbss: "git bisect start" + gc: "git commit --verbose" + gc!: "git commit --verbose --amend" + gcn: "git commit --verbose --no-edit" + gcn!: "git commit --verbose --no-edit --amend" + gca: "git commit --verbose --all" + gca!: "git commit --verbose --all --amend" + gcan!: "git commit --verbose --all --no-edit --amend" + gcans!: "git commit --verbose --all --signoff --no-edit --amend" + gcam: "git commit --all --message" + gcas: "git commit --all --signoff" + gcasm: "git commit --all --signoff --message" + gcb: "git checkout -b" + gcd: "git checkout develop" + gcf: "git config --list" + gcl: "git clone --recurse-submodules" + gclean: "git clean --interactive -d" + gpristine: "git reset --hard; git clean -d --force -x" + gcm: "git checkout (git_main_branch)" + gcmsg: "git commit --message" + gco: "git checkout" + gcor: "git checkout --recurse-submodules" + gcount: "git shortlog --summary --numbered" + gcp: "git cherry-pick" + gcpa: "git cherry-pick --abort" + gcpc: "git cherry-pick --continue" + gcs: "git commit --gpg-sign" + gcss: "git commit --gpg-sign --signoff" + gcssm: "git commit --gpg-sign --signoff --message" + gd: "git diff" + gdca: "git diff --cached" + gdcw: "git diff --cached --word-diff" + gdct: "git describe --tags (git rev-list --tags --max-count=1)" + gds: "git diff --staged" + gdt: "git diff-tree --no-commit-id --name-only -r" + gdup: "git diff @{upstream}" + gdw: "git diff --word-diff" + gf: "git fetch" + gfa: "git fetch --all --prune" + gfo: "git fetch origin" + gg: "git gui citool" + gga: "git gui citool --amend" + ghh: "git help" + gignore: "git update-index --assume-unchanged" + gl: "git log" + glg: "git log --stat" + glgp: "git log --stat --patch" + glgg: "git log --graph" + glgga: "git log --graph --decorate --all" + glgm: "git log --graph --max-count=10" + glo: "git log --oneline --decorate" + glod: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ad(char rp) %C(char lp)bold blue(char rp)<%an>%Creset'" + glods: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ad(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --date=short" + glog: "git log --oneline --decorate --graph" + gloga: "git log --oneline --decorate --graph --all" + glol: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset'" + glola: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --all" + glols: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --stat" + gm: "git merge" + gmtl: "git mergetool --no-prompt" + gmtlvim: "git mergetool --no-prompt --tool=vimdiff" + gma: "git merge --abort" + gmom: "git merge $\"origin/(git_main_branch)\"" + gp: "git push" + gpd: "git push --dry-run" + gpf: "git push --force-with-lease" + gpf!: "git push --force" + gpl: "git pull" + gpoat: "git push origin --all; git push origin --tags" + gpod: "git push origin --delete" + gpodc: "git push origin --delete (git_current_branch)" + gpr: "git pull --rebase" + gpu: "git push upstream" + gpv: "git push --verbose" + gr: "git remote" + gpra: "git pull --rebase --autostash" + gprav: "git pull --rebase --autostash --verbose" + gprv: "git pull --rebase --verbose" + gpsup: "git push --set-upstream origin (git_current_branch)" + gra: "git remote add" + grb: "git rebase" + grba: "git rebase --abort" + grbc: "git rebase --continue" + grbd: "git rebase develop" + grbi: "git rebase --interactive" + grbm: "git rebase (git_main_branch)" + grbo: "git rebase --onto" + grbs: "git rebase --skip" + grev: "git revert" + grh: "git reset" + grhh: "git reset --hard" + groh: "git reset $\"origin/(git_current_branch)\" --hard" + grm: "git rm" + grmc: "git rm --cached" + grmv: "git remote rename" + grrm: "git remote remove" + grs: "git restore" + grset: "git remote set-url" + grss: "git restore --source" + grst: "git restore --staged" + grt: "cd (git rev-parse --show-toplevel | complete | if $in.exit_code == 0 { $in.stdout | str trim } else { '.' })" + gru: "git reset --" + grup: "git remote update" + grv: "git remote --verbose" + gsb: "git status --short --branch" + gsd: "git svn dcommit" + gsh: "git show" + gshs: "git show -s" + gsi: "git submodule init" + gsps: "git show --pretty=short --show-signature" + gsr: "git svn rebase" + gss: "git status --short" + gst: "git status" + gsta: "git stash push" + gstaa: "git stash apply" + gstc: "git stash clear" + gstd: "git stash drop" + gstl: "git stash list" + gstp: "git stash pop" + gsts: "git stash show --text" + gstu: "gsta --include-untracked" + gstall: "git stash --all" + gsu: "git submodule update" + gsw: "git switch" + gswc: "git switch --create" + gts: "git tag --sign" + gtv: "git tag | lines | sort" + glum: "git pull upstream (git_main_branch)" + gunignore: "git update-index --no-assume-unchanged" + gup: "git pull --rebase" + gupv: "git pull --rebase --verbose" + gupa: "git pull --rebase --autostash" + gupav: "git pull --rebase --autostash --verbose" + gwch: "git whatchanged -p --abbrev-commit --pretty=medium" + gwt: "git worktree" + gwtls: "git worktree list" + gwtmv: "git worktree move" + gwtm: "git worktree remove" + gam: "git am" + gamc: "git am --continue" + gams: "git am --skip" + gama: "git am --abort" + gamscp: "git am --show-current-patch" +}