Adds mhlink script, which still needs some work and updates to nvim config, which fixes tmux-navigator mappings

This commit is contained in:
2023-10-06 17:47:32 -04:00
parent 346ff30f4a
commit 3fcb57d090
4 changed files with 54 additions and 7 deletions

43
scripts/scripts/mhlink Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env zsh
root=
localOpt=
zparseopts -- \
{l,-local}=localOpt
if [ -d "$HOME/projects/github.com/m-housh/mhoush.com" ]; then
root="$HOME/projects/github.com/m-housh/mhoush.com"
else
root="$HOME/projects/mhoush.com"
fi
postsPath="$root/content/posts"
# Abort early if the post path does not exist.
[ ! -d $postsPath ] \
&& echo "Could not find posts directory" \
&& exit 1
posts=$(find "$postsPath" -mindepth 1 -maxdepth 1 -type d -print0 | \
xargs -0 stat -f"%m %Sm %N" | \
sort -rn
)
choice=$(echo "$posts" | fzf)
[ -z $choice ] \
&& echo "No selection made." \
&& exit 1
# Delete everything before the last /
choice="${choice##*/}"
prefix="https://mhoush.com"
if [ -n "$localOpt" ]; then
prefix="http://localhost:1313"
fi
echo "$prefix/$choice/"