diff --git a/TODO.md b/TODO.md
index b3fbb7c..8a56ef8 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,6 +1,6 @@
# TODO
-- Remove brewfiles and use the `dots` cli manager instead.
+- Add zsh functions to dots cli manager.
- Add tmux plugins to dots cli manager.
- Add tmux-powerline linking to `dots` cli manager.
-
+- Clean up zet commands, maybe make a gum / fzf filter script.
diff --git a/macOS/LaunchAgents/com.michael.clear-screenshots.plist b/macOS/LaunchAgents/com.michael.clear-screenshots.plist
index ed33765..c1eecbd 100644
--- a/macOS/LaunchAgents/com.michael.clear-screenshots.plist
+++ b/macOS/LaunchAgents/com.michael.clear-screenshots.plist
@@ -6,9 +6,9 @@
com.micheal.clear-screenshots
ProgramArguments
- sh
+ zsh
-c
- /Users/michael/.local/scripts/clear_screenshots
+ /Users/michael/.config/zsh/functions/clean-screenshots
StartCalendarInterval
diff --git a/scripts/scripts/cdots b/scripts/scripts/cdots
deleted file mode 100755
index c063421..0000000
--- a/scripts/scripts/cdots
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-session="dots"
-
-tmux switch-client -t "$session" || \
- tmux attach -t "$session" || \
- tmux new-session -c "$DOTFILES" -s "$session"
diff --git a/scripts/scripts/chmox b/scripts/scripts/chmox
deleted file mode 100755
index ac2727b..0000000
--- a/scripts/scripts/chmox
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-# makes files executable
-test -f "$1" && chmod +x "$1"
diff --git a/scripts/scripts/clean-screenshots b/scripts/scripts/clean-screenshots
deleted file mode 100755
index 29bb217..0000000
--- a/scripts/scripts/clean-screenshots
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-for file in "$SCREENSHOTS"/*; do
- rm "$file"
-done
diff --git a/scripts/scripts/cmt b/scripts/scripts/cmt
index 839a5fc..01b18ab 100755
--- a/scripts/scripts/cmt
+++ b/scripts/scripts/cmt
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/zsh
# adapted from...
# https://github.com/rwxrob/dot/blob/main/scripts/cmt
diff --git a/scripts/scripts/desktop b/scripts/scripts/desktop
deleted file mode 100755
index c2b9b3f..0000000
--- a/scripts/scripts/desktop
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/zsh
-
-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
- exit 0
-fi
-
-if [ -n "$show" ]; then
- defaults write com.apple.finder CreateDesktop true && killall Finder
- exit 0
-fi
-
-echo "Please pass in --hide | --show"
-exit 1
diff --git a/scripts/scripts/dmg b/scripts/scripts/dmg
deleted file mode 100755
index ef7dad5..0000000
--- a/scripts/scripts/dmg
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# Creates an encrypted disk image from a folder
-
-set -e
-
-from="$1"
-to="$2"
-
-if [ -z "$1" ] || [ -z "$2" ]; then
- echo "Usage: dmg "
- echo ""
- exit 1
-fi
-
-name="$(isosec).dmg"
-hdiutil create -encryption AES-256 -srcfolder "$from" "$to/$name"
diff --git a/scripts/scripts/isosec b/scripts/scripts/isosec
index 1c38423..ef26e0e 100755
--- a/scripts/scripts/isosec
+++ b/scripts/scripts/isosec
@@ -1,9 +1,4 @@
#!/bin/sh
-set -e
+date -u '+%Y%m%d%H%M%S'
-isosec() {
- echo "$(date -u '+%Y%m%d%H%M%S')"
-}
-
-isosec
diff --git a/scripts/scripts/l b/scripts/scripts/l
deleted file mode 100755
index b1eef16..0000000
--- a/scripts/scripts/l
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-# Lists files and directories, including hidden files.
-
-ls -lah --color "$@"
diff --git a/scripts/scripts/mkcd b/scripts/scripts/mkcd
deleted file mode 100755
index 5294be4..0000000
--- a/scripts/scripts/mkcd
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# Creates a directory then `cd`'s into the directory
-
-set -e
-
-dir="$1"
-
-test -n "${dir}" || echo "usage: mkcd " && exit 1
-
-mkdir "${dir}"
-cd "${dir}"
diff --git a/scripts/scripts/ncis b/scripts/scripts/ncis
index a9fb6e9..f6f11b5 100755
--- a/scripts/scripts/ncis
+++ b/scripts/scripts/ncis
@@ -2,10 +2,10 @@
set -e
-# Creates a new `zet` inside the House Call Pro `Zettlekasten`
+# Creates a new `zet` inside the NCI Summit `Zettlekasten`
_main() {
- (ZETDIR="$HOME/Documents/NCISummit" eval zet "$@")
+ ZETDIR="$HOME/Documents/NCISummit" eval zet "$@"
}
_main "$@"
diff --git a/scripts/scripts/newx b/scripts/scripts/newx
index 995c536..2ea9212 100755
--- a/scripts/scripts/newx
+++ b/scripts/scripts/newx
@@ -16,7 +16,7 @@ shell="${2:-sh}"
if [ -e "${path}" ]; then
echo "Already exists try:"
- echo "vi ${path}"
+ echo "$EDITOR $path"
exit 1
fi
diff --git a/scripts/scripts/nvims b/scripts/scripts/nvims
index 764423c..694892a 100755
--- a/scripts/scripts/nvims
+++ b/scripts/scripts/nvims
@@ -1,13 +1,19 @@
-#!/bin/sh
+#!/bin/zsh
# Change / select an nvim configuration.
+#
+# The configuration's need to be in the ~/.config folder
+# to work properly.
+#
main() {
items=("default" "m-housh" "kickstart" "lazy")
- config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config ➣ " --height=50% --layout=reverse --border --exit-0)
- if [[ -z $config ]]; then
+ config=$(printf "%s\n" "${items[@]}" \
+ | fzf --prompt=" Neovim Config ➣ " --height=50% --layout=reverse --border --exit-0
+ )
+ if [ -z "$config" ]; then
echo "Nothing selected"
return 0
- elif [[ $config == "default" ]]; then
+ elif [ $config == "default" ]; then
config=""
fi
unset VIMINIT && unset MYVIMRC && export NVIM_APPNAME=$config && nvim $@
diff --git a/scripts/scripts/proposals b/scripts/scripts/proposals
deleted file mode 100755
index e1eabb5..0000000
--- a/scripts/scripts/proposals
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/zsh
-
-# Move into the proposals directory
-cd "$HOME/Library/Mobile Documents/com~apple~CloudDocs/Work/Proposals"
diff --git a/scripts/scripts/pzet b/scripts/scripts/pzet
index 64c716a..daf4659 100755
--- a/scripts/scripts/pzet
+++ b/scripts/scripts/pzet
@@ -2,7 +2,7 @@
set -e
-# Creates a new `zet` inside the House Call Pro `Zettlekasten`
+# Creates a new `zet` inside the private `Zettlekasten`
_main() {
(ZETDIR="$GHREPOS/private-zets" eval zet "$@")
diff --git a/scripts/scripts/vic b/scripts/scripts/vic
deleted file mode 100755
index 4543da3..0000000
--- a/scripts/scripts/vic
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-# opens a shell command in $EDITOR
-cmd="$(command -v $1)"
-test -n "$cmd" && "$EDITOR" "$cmd"
diff --git a/zsh/config/.zshenv b/zsh/config/.zshenv
index f211e16..9400345 100644
--- a/zsh/config/.zshenv
+++ b/zsh/config/.zshenv
@@ -2,6 +2,7 @@
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local"
export ZDOTDIR="$HOME/.config/zsh"
+export ZFUNCDIR="$ZDOTDIR/functions"
export SHELL="$(which zsh)"
# Git
diff --git a/zsh/config/functions/cdots b/zsh/config/functions/cdots
new file mode 100755
index 0000000..5aebbfc
--- /dev/null
+++ b/zsh/config/functions/cdots
@@ -0,0 +1,6 @@
+#!/usr/bin/env zsh
+
+function cdots() {
+ "$SCRIPTS/tmux-sessionator" "$DOTFILES"
+}
+
diff --git a/zsh/config/functions/chmox b/zsh/config/functions/chmox
new file mode 100755
index 0000000..d809897
--- /dev/null
+++ b/zsh/config/functions/chmox
@@ -0,0 +1,8 @@
+#!/bin/zsh
+
+# makes files executable
+
+function chmox() {
+ [ ! -f "$1" ] && echo "usage: chmox " && return 1
+ chmod u+x "$1"
+}
diff --git a/zsh/config/functions/clean-screenshots b/zsh/config/functions/clean-screenshots
new file mode 100755
index 0000000..5e8914b
--- /dev/null
+++ b/zsh/config/functions/clean-screenshots
@@ -0,0 +1,7 @@
+#!/bin/zsh
+
+function clean-screenshots() {
+ for file in "$SCREENSHOTS"/*; do
+ rm "$file"
+ done
+}
diff --git a/zsh/config/functions/desktop b/zsh/config/functions/desktop
new file mode 100755
index 0000000..92135c6
--- /dev/null
+++ b/zsh/config/functions/desktop
@@ -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
+}
diff --git a/zsh/config/functions/dmg b/zsh/config/functions/dmg
new file mode 100755
index 0000000..16d3ab2
--- /dev/null
+++ b/zsh/config/functions/dmg
@@ -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 "
+ echo ""
+ return 1
+ fi
+
+ name="$(isosec).dmg"
+ hdiutil create -encryption AES-256 -srcfolder "$from" "$to/$name"
+}
diff --git a/zsh/config/functions/mkcd b/zsh/config/functions/mkcd
new file mode 100755
index 0000000..bd4b536
--- /dev/null
+++ b/zsh/config/functions/mkcd
@@ -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 " && return 1
+ fi
+ mkdir "$dir"
+ cd "$dir"
+}
diff --git a/zsh/config/functions/n b/zsh/config/functions/n
index 9f852e9..7147390 100755
--- a/zsh/config/functions/n
+++ b/zsh/config/functions/n
@@ -8,9 +8,17 @@
#
function n() {
- [ -d "$1" ] || [ -z "$1" ] \
- && nvim -c ":Telescope find_files" \
- && return 0
+ 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 "$1"
}
diff --git a/zsh/config/functions/vic b/zsh/config/functions/vic
new file mode 100755
index 0000000..4c05d42
--- /dev/null
+++ b/zsh/config/functions/vic
@@ -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
+}