Created
October 16, 2015 06:14
-
-
Save Dru89/50b53ce6c6877b77b319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############# | |
# NOTE TAKING | |
function n() { | |
NAME=$1 | |
if [[ "$NAME" != *.md ]]; then | |
NAME="${NAME}.md" | |
fi | |
${NOTES_EDITOR:-$EDITOR} "${NOTES_DIR:-$HOME/.notes}/$NAME" | |
} | |
function ngrep() { | |
GREP=$((command -v ag >/dev/null 2>&1 && echo "ag") || \ | |
(command -v ack >/dev/null 2>&1 && echo "ack") || \ | |
echo "grep") | |
$GREP "$*" ${NOTES_DIR:-$HOME/.notes} | |
} | |
function nls() { | |
if [ $# -eq 0 ]; then | |
ls -c ${NOTES_DIR:-$HOME/.notes} | |
else | |
GREP=$((command -v ag >/dev/null 2>&1 && echo "ag") || \ | |
(command -v ack >/dev/null 2>&1 && echo "ack") || \ | |
echo "grep") | |
ls -c ${NOTES_DIR:-$HOME/.notes} | $GREP "$*" | |
fi | |
} | |
compctl -f -W ${NOTES_DIR:-$HOME/.notes} n | |
compctl -f -W ${NOTES_DIR:-$HOME/.notes} nls | |
compctl -f -W ${NOTES_DIR:-$HOME/.notes} ngrep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment