This repository contains utilities for custom terminal configurations.
Make sure that no $HOME/custom-terminal already exists. If it does, rename the repository.
Clone this repository in the $HOME directory:
git cloneAdd the following to your .zshrc:
for f in $HOME/custom-terminal/src/*; do source $f; doneThis will load:
custom-terminal/
|- aliases.sh
|- autocompletion.sh
|- functions.sh
|- prompt-styling.shIt adds the following:
- prompt styling,
- custom shell functions (mostly git shortcuts),
- custom aliases registration,
- autocompletion.
The general prompt header will have this format:
[user]@[machine] /path/to/dir $When in a git repository instead, /path/to/dir will be relative to the git repository root, showing also the branch:
[user]@[machine] ( [branch] [repo]/path/from/root ) $Currently available:
-
gga(): git graph all :arguments:
N: num of entries to display (optional, default=10)command:
git log --oneline --graph --all -n $Nusage:
gga 20
-
gg(): git graph :arguments:
N: num of entries to display (optional, default=10)command:
git log --oneline --graph -n $Nusage:
gg 20
-
gbl(): git branch list :arguments:
nonecommand:
for k in $(git branch | perl -pe s/^..//); do echo -e $(git show --pretty=format:""%ci ${BLUE}%cr${NC}"" $k -- | head -n 1)\\t${GREEN}$k${NC}; done | sort
usage:
gbl
-
gc(): git checkout :arguments:
B: branch (optional, default=main, on error try: master)command:
git checkout $Busage:
gc mybranch
-
gcmb(): git checkout -b [new-branch]:arguments:
B: branchcommand:
git checkout -b $Busage:
gcmb my-new-branch
-
gaac(): git add and commit :arguments:
C: commit message (required)command:
git add . && git commit -m "$C"
usage:
gaac "my commit message"
-
gcmm(): git commit -m message:arguments:
C: commit message (required)command:
git commit -m "$C"usage:
gcmm "my commit message"
-
cdgr(): cd git rootarguments:
nonecommand:
cd $(git rev-parse --show-toplevel)
usage:
cdgr
-
cdl(): cd and listarguments:
D: directory (required)command:
cd "$D" && ls -al
usage:
cdl subfolder
You can remove the functions you don't need from custom-terminal/aliases.sh.
It registers the following aliases:
| alias | command |
|---|---|
ll |
ls -la |
nanozsh |
nano $HOME/.zshrc |
tree1 |
tree -L 1 |
source_zshrc |
source $HOME/.zshrc |
You can remove the alias you don't need from custom-terminal/aliases.sh.
It uses the following to set the autocompletion up:
autoload -Uz compinit && compinit