Skip to content

Instantly share code, notes, and snippets.

@sts10
Last active September 23, 2015 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sts10/8970781 to your computer and use it in GitHub Desktop.
Save sts10/8970781 to your computer and use it in GitHub Desktop.
Jot v 0.0.3 -- A note-taking script. Can be pasted into your .bash_profile
function jot {
MAP="/Users/samschlinkert/Documents/code/jot/path.txt"
JOT_ROUTE=$(<$MAP)
if [[ $1 == here ]]
then
NEW_PATH=$(pwd)
echo "$NEW_PATH/" > $MAP
echo "Now jotting in "$NEW_PATH
elif [[ $1 == where ]]
then
echo "You're jotting in "$JOT_ROUTE
echo "Do you want to go there? (y/n) "
read -p "" -n 1 -r
echo '' # move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
cd $JOT_ROUTE
fi
elif [[ $1 == help ]]
then
echo "jot here to place the jot."
echo "jot where to ask where you're currently jotting."
echo "jot <file name, no extension> to jot a new file."
elif [[ $1 == all ]]
then
mvim $JOT_ROUTE
else
INPUT=$*
NOTE_TITLE=${INPUT// /-} # replace all spaces with hyphens
touch $JOT_ROUTE"$NOTE_TITLE".mdown
mvim $JOT_ROUTE"$NOTE_TITLE".mdown
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment