From f9892ee95284d7609c8480e475ab963dcee9e981 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Tue, 28 Dec 2021 15:20:30 -0500 Subject: [PATCH] Added some scripts --- scripts/.local/scripts/figl | 16 ++++++++++++++++ scripts/.local/scripts/newx | 24 ++++++++++++++++++++++++ scripts/.local/scripts/path | 2 ++ zsh/.config/zsh/.zshrc | 2 ++ zsh/.config/zsh/zsh-aliases | 4 ++++ 5 files changed, 48 insertions(+) create mode 100755 scripts/.local/scripts/figl create mode 100755 scripts/.local/scripts/newx create mode 100755 scripts/.local/scripts/path diff --git a/scripts/.local/scripts/figl b/scripts/.local/scripts/figl new file mode 100755 index 0000000..3a78237 --- /dev/null +++ b/scripts/.local/scripts/figl @@ -0,0 +1,16 @@ +#!/bin/bash + +# Create a new figlet (ascii art) from the input. + +figl() { + font=${FIGL_FONT:-puffy} + declare -a buf + while IFS= read -r line; do + buf+=("$line") + done + for line in "${buf[@]}"; do + figlet -f "$font" -c "${line}" | head -6 + done +} + +figl "$*" diff --git a/scripts/.local/scripts/newx b/scripts/.local/scripts/newx new file mode 100755 index 0000000..5a55416 --- /dev/null +++ b/scripts/.local/scripts/newx @@ -0,0 +1,24 @@ +#!/bin/sh + +# Creates a new executable file in the $SCRIPTS directory. + +# check if the scripts path / environment variable is set +test ! -n "${SCRIPTS}" && echo "SCRIPTS not set" && exit 1; + +# fallback to check if the name arg ${1} exists, if not show usage text. +test ! -n "${1}" && echo "usage: newscript " && exit 1; + +path="${SCRIPTS}/${1}" + +if [ -e "${path}" ]; then + read -p "${1} already exists. Edit? " yes + case "${yes}" in + y|yes|yep|yeppers|yeah|ok|okay) exec vim "${path}" + esac + exit 0 +fi + +printf "#!/bin/sh\n\n" > "${path}" +chmod +x "${path}" +exec vim +2 "${path}" + diff --git a/scripts/.local/scripts/path b/scripts/.local/scripts/path new file mode 100755 index 0000000..9b30d62 --- /dev/null +++ b/scripts/.local/scripts/path @@ -0,0 +1,2 @@ +#!/bin/zsh +echo -e ${PATH//:/\\n} diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 875abd2..f2ca669 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -63,6 +63,8 @@ fpath_prepend() { # last arg will be first in path path_prepend \ + "/opt/homebrew/bin" \ + "/opt/homebrew/sbin" \ "$(brew --prefix)/sbin" \ "$(brew --prefix)/bin" \ "$HOME/.local/bin" \ diff --git a/zsh/.config/zsh/zsh-aliases b/zsh/.config/zsh/zsh-aliases index d95c200..c10f93f 100644 --- a/zsh/.config/zsh/zsh-aliases +++ b/zsh/.config/zsh/zsh-aliases @@ -39,6 +39,7 @@ alias l() { ls -lah "$@" } # editor alias vim() { nvim "$@" } +alias vi() { nvim "$@" } # git alias g() { git "$@" } @@ -58,6 +59,9 @@ if [ $(hostname -s) = "Michaels-Mac-mini" ]; then alias projects() { cd "/Volumes/M1 Mac-Mini External Drive/Projects" } fi +# change file to be executable +alias chmox() { chmod +x "$@" } + # tmux #alias ta() { tmux -f ~/.config/tmux/tmux.config attach "$@" }