From bc91c33378bca18182b34230fdff317eb5d8cb3f Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Fri, 29 Aug 2025 16:18:06 +0530 Subject: [PATCH] refactor: Remove spurious files & move around aliases --- 10x_alias.sh | 39 +++++++++++++++++++-------------------- 10x_create_git_repo.sh | 10 ---------- 10x_nvim.sh | 15 --------------- 3 files changed, 19 insertions(+), 45 deletions(-) delete mode 100644 10x_create_git_repo.sh delete mode 100644 10x_nvim.sh diff --git a/10x_alias.sh b/10x_alias.sh index a69acb8..7eb632b 100644 --- a/10x_alias.sh +++ b/10x_alias.sh @@ -1,6 +1,18 @@ #!/bin/sh -# Git +# Templates +[ ! -f "$GITIGNORE_TEMPLATE" ] || alias cp_gi='cp ${GITIGNORE_TEMPLATE} .' +[ ! -f "$PRETTIER_TEMPLATE" ] || alias cp_prc='cp ${PRETTIER_TEMPLATE} .' +[ ! -f "$PRETTIER_IGNORE_TEMPLATE" ] || alias cp_prigr='cp ${PRETTIER_IGNORE_TEMPLATE} .' + +command -v tldr >/dev/null && alias tldr="tldr --platform=linux" +command -v tldr >/dev/null && alias h="tldr" +command -v fzf >/dev/null && alias path="printenv | grep ^PATH= | sed 's/^PATH=//' | tr ':' '\n' | fzf" +command -v podman >/dev/null && alias docker=podman + +alias cd_root='cd $(git rev-parse --show-toplevel 2>/dev/null || echo ".")' +alias cd_git_root=cd_root + git_push_all_changes() { if [ -z "$1" ] || [ "$1" = " " ]; then echo "Please provide a commit message." @@ -8,25 +20,6 @@ git_push_all_changes() { fi git add . && git commit -am "${1}" && git push } -alias git_just_push=git_push_all_changes -alias cd_root='cd $(git rev-parse --show-toplevel 2>/dev/null || echo ".")' -alias cd_git_root=cd_root -[ ! -f "$GITIGNORE_TEMPLATE" ] || alias cp_gi='cp ${GITIGNORE_TEMPLATE} .' - -# command -v eza >/dev/null && alias ls="eza --hyperlink --header --git -M --icons=auto --color=never" -alias ls='ls --color=auto --hyperlink' -alias ll='ls -alhF' -alias la='ls -Ah' -alias lsa="ls -lAFhZ" -command -v tldr >/dev/null && alias tldr="tldr --platform=linux" -command -v tldr >/dev/null && alias mann="tldr" -command -v tldr >/dev/null && alias help="tldr" - -alias printpath="echo $PATH | tr : '\n'" -command -v fzf >/dev/null && alias path="printenv | grep ^PATH= | sed 's/^PATH=//' | tr ':' '\n' | fzf" - -[ ! -f "$PRETTIER_TEMPLATE" ] || alias cp_prc='cp ${PRETTIER_TEMPLATE} .' -[ ! -f "$PRETTIER_IGNORE_TEMPLATE" ] || alias cp_prigr='cp ${PRETTIER_IGNORE_TEMPLATE} .' cp_gitprecommit() { if [ ! -f "$GIT_PRECOMMIT_TEMPLATE" ]; then @@ -49,6 +42,12 @@ cp_gitprecommit() { cp "$GIT_PRECOMMIT_TEMPLATE" "$hooks_dir" && printf "Pre-commit hook template copied to %s\n" "$hooks_dir" } +alias ls='ls --color=auto --hyperlink' +alias ll='ls -alhF' +alias la='ls -Ah' +alias lsa="ls -lAFhZ" +alias printpath="echo $PATH | tr : '\n'" + port_who() { if [ -z "$1" ] || [ "$1" = " " ]; then echo "Please provide port number" diff --git a/10x_create_git_repo.sh b/10x_create_git_repo.sh deleted file mode 100644 index bd0f713..0000000 --- a/10x_create_git_repo.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# TODO: -# - Fn that creates a gitea repo -# - Accept a name -# - On success display the remote ssh url + commands to add it to an existing repo -# curl "http://git.pratik.live/api/v1/activitypub/user-id/pratik" \ -# -H "accept: application/json" \ -# -H "Authorization: token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -# -H "Content-Type: application/json" -d "{ \"body\": \"testing\", \"title\": \"test 20\"}" -i diff --git a/10x_nvim.sh b/10x_nvim.sh deleted file mode 100644 index 59df015..0000000 --- a/10x_nvim.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Nvim Distro-Switcher -alias nvim-lazy="NVIM_APPNAME=nvim-lazy nvim" -nvims() { - config=$(find -L "$HOME"/.config -maxdepth 2 -name "init.lua" -type f -execdir sh -c 'pwd | xargs basename' \; | fzf --prompt=" Neovim Config ") - - if [ "$config" = "" ]; then - echo "Nothing selected" - return 0 - fi - NVIM_APPNAME=$config nvim "$@" -} -# Nvim Distro-Switcher -alias nvim-lazy="NVIM_APPNAME=nvim-lazy nvim"