feat: Moves most configuration

This commit is contained in:
2025-09-27 21:36:25 -04:00
parent 15b488f3a5
commit 9ae31715a3
148 changed files with 22 additions and 2757 deletions

5
env/.config/zsh/functions/brew-update vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env zsh
function brew-update() {
brew update && brew upgrade --greedy && brew cleanup
}

6
env/.config/zsh/functions/cdots vendored Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env zsh
function cdots() {
"$SCRIPTS/tmux-sessionator" "$DOTFILES"
}

8
env/.config/zsh/functions/chmox vendored Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/zsh
# makes files executable
function chmox() {
[ ! -f "$1" ] && echo "usage: chmox <file>" && return 1
chmod u+x "$1"
}

7
env/.config/zsh/functions/clean-screenshots vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/zsh
function clean-screenshots() {
for file in "$SCREENSHOTS"/*; do
rm "$file"
done
}

23
env/.config/zsh/functions/desktop vendored Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/zsh
function desktop() {
declare hide
declare show
zparseopts -D -E -K -- \
{h,-hide}=hide \
{s,-show}=show
if [ -n "$hide" ]; then
defaults write com.apple.finder CreateDesktop false && killall Finder
return 0
fi
if [ -n "$show" ]; then
defaults write com.apple.finder CreateDesktop true && killall Finder
return 0
fi
echo "Please pass in --hide | --show"
return 1
}

16
env/.config/zsh/functions/dmg vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/zsh
# Creates an encrypted disk image from a folder
function dmg() {
from="$1"
to="$2"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: dmg <fromdir> <todir>"
echo ""
return 1
fi
name="$(isosec).dmg"
hdiutil create -encryption AES-256 -srcfolder "$from" "$to/$name"
}

12
env/.config/zsh/functions/dp vendored Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/zsh
function dp() {
[ -z "$1" ] && echo "Must supply temperature" && return 1
[ -z "$2" ] && echo "Must supply relative humidity" && return 1
local temperature=$1
local humidity=$2
/opt/homebrew/bin/psychrometrics dew-point --dry-bulb "$temperature" --relative-humidity "$humidity"
}

5
env/.config/zsh/functions/edit-ssh-config vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/zsh
function edit-ssh-config() {
ansible-vault edit "$DOTFILES/ssh/config"
}

7
env/.config/zsh/functions/find-latest vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/zsh
# Find the last modified file in a directory.
function find-latest() {
local dir=$1
echo "$(find $dir -maxdepth 1 -mindepth 1 -type f | sort -nr | head -1)"
}

8
env/.config/zsh/functions/gl vendored Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/zsh
# Prettier git log
function gl() {
git log --graph \
--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \
--abbrev-commit
}

11
env/.config/zsh/functions/gma vendored Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/zsh
# Add all and commit to git.
function gma() {
[ -z "$1" ] \
&& echo "usage: gma <commit-message>" \
&& return 1
git add . && git commit -m "$1"
}

5
env/.config/zsh/functions/gpgreset vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/zsh
function gpgreset() {
gpgconf --kill all && gpgconf --launch all
}

12
env/.config/zsh/functions/mkcd vendored Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env zsh
# Creates a directory then `cd`'s into the directory
function mkcd() {
dir=$1
if [ -z "$dir" ]; then
echo "usage: mkcd <dir>" && return 1
fi
mkdir "$dir"
cd "$dir"
}

25
env/.config/zsh/functions/n vendored Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env zsh
# Open's neovim.
#
# If the argument passed in is a directory or not supplied, then
# open neovim with telescope find files opened. Otherwise open the
# file that is supplied.
#
function n() {
# if [ -z "$1" ]; then
# local gitdir=$(git rev-parse --show-toplevel 2> /dev/null)
#
# [ -n "$gitdir" ] \
# && nvim -c ":Telescope git_files" \
# && return 0
#
# [ -d "$1" ] \
# && nvim -c ":Telescope find_files" \
# && return 0
# fi
nvim "$@"
}

13
env/.config/zsh/functions/new-proposal vendored Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/zsh
prefix=$(date '+%y.%m.%d')
name=$(gum input --placeholder="Enter customer name...")
if [ -z "$name" ]; then
echo "Name should not be blank." && exit 1
fi
cleanedName="${name%% *}${name##* }"
directory="$PROPOSALS/$prefix.$cleanedName"
mkdir "$directory"
echo "$directory"

7
env/.config/zsh/functions/shortdate vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/zsh
# Formats the date as '23.10.12'.
function shortdate() {
echo "$(date '+%Y.%m.%d' | cut -c3-)"
}

17
env/.config/zsh/functions/tns vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env zsh
# Create a tmux session.
#
# This accepts a path argument that is used to create the tmux session
# in, using it's basename for the session name.
#
# If an argument is not supplied, then we will create a tmux session in
# the current working directory.
function tns() {
local directory=$1
if [ -n "$directory" ]; then
directory=${PWD}
fi
tmux-sessionator --directory "$directory"
}

6
env/.config/zsh/functions/update-dots vendored Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/zsh
function update-dots() {
find "$ANSIBLE_MACOS_PLAYBOOK_DIR" -type f -maxdepth 1 -mindepth 1 -name justfile \
| xargs -I {} just --justfile {} run-playbook --tags dotfiles "$@"
}

19
env/.config/zsh/functions/vic vendored Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/zsh
function vic() {
# opens a shell command in $EDITOR
cmd="$(command -v $1)"
[ -f "$cmd" ] \
&& "$EDITOR" "$cmd" \
&& return 0
# if command was not found try the function directory.
cmd="$ZFUNCDIR/$1"
[ -f "$cmd" ] \
&& "$EDITOR" "$cmd" \
&& return 0
echo "Command not found: $1"
return 1
}