chore: Changes

- Move tmux aliases to dotfiles
- cpgi -> cp_gi : in sync with all other cp_* aliases
- mann aliases for tldr
- Git precommit template copy with cp_gitprecommit
This commit is contained in:
Pratik Tripathy
2024-12-24 20:01:48 +05:30
parent d403585c3a
commit 0f94e435e2

View File

@@ -11,22 +11,16 @@ git_push_all_changes() {
alias git_just_push=git_push_all_changes alias git_just_push=git_push_all_changes
alias cd_root='cd $(git rev-parse --show-toplevel 2>/dev/null || echo ".")' alias cd_root='cd $(git rev-parse --show-toplevel 2>/dev/null || echo ".")'
alias cd_git_root=cd_root alias cd_git_root=cd_root
[ ! -f "$GITIGNORE_TEMPLATE" ] || alias cpgi='cp ${GITIGNORE_TEMPLATE} .' [ ! -f "$GITIGNORE_TEMPLATE" ] || alias cp_gi='cp ${GITIGNORE_TEMPLATE} .'
# Tmux
command -v tmux >/dev/null && alias ta="tmux a"
command -v tmux >/dev/null && alias tat="tmux a -t"
command -v tmux >/dev/null && alias tls="tmux ls"
command -v tmux >/dev/null && alias tnew="tmux new"
command -v tmux >/dev/null && alias tnewt="tmux new -t"
# command -v eza >/dev/null && alias ls="eza --hyperlink --header --git -M --icons=auto --color=never" # command -v eza >/dev/null && alias ls="eza --hyperlink --header --git -M --icons=auto --color=never"
alias ls='ls --color=auto --hyperlink' alias ls='ls --color=auto --hyperlink'
alias ll='ls -alhF' alias ll='ls -alhF'
alias la='ls -Ah' alias la='ls -Ah'
alias lsa="ls -lAFhZ" alias lsa="ls -lAFhZ"
alias tldr="tldr --platform=linux " command -v tldr >/dev/null && alias tldr="tldr --platform=linux"
alias h="tldr" command -v tldr >/dev/null && alias mann="tldr"
command -v tldr >/dev/null && alias help="tldr"
alias printpath="echo $PATH | tr : '\n'" alias printpath="echo $PATH | tr : '\n'"
command -v fzf >/dev/null && alias path="printenv | grep ^PATH= | sed 's/^PATH=//' | tr ':' '\n' | fzf" command -v fzf >/dev/null && alias path="printenv | grep ^PATH= | sed 's/^PATH=//' | tr ':' '\n' | fzf"
@@ -34,6 +28,27 @@ command -v fzf >/dev/null && alias path="printenv | grep ^PATH= | sed 's/^PATH=/
[ ! -f "$PRETTIER_TEMPLATE" ] || alias cp_prc='cp ${PRETTIER_TEMPLATE} .' [ ! -f "$PRETTIER_TEMPLATE" ] || alias cp_prc='cp ${PRETTIER_TEMPLATE} .'
[ ! -f "$PRETTIER_IGNORE_TEMPLATE" ] || alias cp_prigr='cp ${PRETTIER_IGNORE_TEMPLATE} .' [ ! -f "$PRETTIER_IGNORE_TEMPLATE" ] || alias cp_prigr='cp ${PRETTIER_IGNORE_TEMPLATE} .'
cp_gitprecommit() {
if [ ! -f "$GIT_PRECOMMIT_TEMPLATE" ]; then
echo "Git Pre-commit template does not exist"
return 1
fi
hooks_dir="$(pwd)/.git/hooks"
if [ ! -d "$hooks_dir" ]; then
echo "Git repository not found under $(pwd)"
return 2
fi
if [ -f "$hooks_dir/$(basename "$GIT_PRECOMMIT_TEMPLATE")" ]; then
echo "pre-commit hook already exist. Skipping..."
return 0
fi
cp "$GIT_PRECOMMIT_TEMPLATE" "$hooks_dir" && printf "Pre-commit hook template copied to %s\n" "$hooks_dir"
}
port_who() { port_who() {
if [ -z "$1" ] || [ "$1" = " " ]; then if [ -z "$1" ] || [ "$1" = " " ]; then
echo "Please provide port number" echo "Please provide port number"