Skip to content

Instantly share code, notes, and snippets.

@belkarx
Last active April 10, 2022 02:34
Show Gist options
  • Save belkarx/f3af7c1176ade27107330fa09c84f271 to your computer and use it in GitHub Desktop.
Save belkarx/f3af7c1176ade27107330fa09c84f271 to your computer and use it in GitHub Desktop.
Todos and notetaking
# Opens up a text document in the ~/notes/jour folder
# with the date as the name (in the *best* format, as 2022-01-01)
# and appends a timestamp (padded with newlines, I should add a conditional to not prepad if the file doesn't exist yet but it doesn't really bother me atm)
# then your cursor is directly below the timestamp and you can make an entry
#[jour means day in french]
alias jour='echo "\n$(date +%T)\n" >> $HOME/notes/jour/$(date +%Y-%m-%d) && nvim -c "+normal G$" $HOME/notes/jour/$(date +%Y-%m-%d)'
#makes a note in ~/notes from anywhere (spaces in filename are replaced by underscores)
not() {
nvim -c "startinsert" ~/notes/$(echo $@ | sed 's/\ /_/g')
}
#edit todos
alias todo="nvim $HOME/todo"
#autocomplete the ~/notes folder when using `not` (zsh-specific)
_s_comp() {
if [ $OS = "mac" ]; then
local LS=gls;
else
local LS=ls;
fi
reply=(`$LS --ignore-backups $HOME/notes/`);
}
compctl -K _not_comp not
# At the end of ~/.zshrc (also works for ~/.bashrc)
cat $HOME/todo
#optionally, replace that with this function (colorizes most important todos)
important_todo() {
while read i
do
if grep -q "$i" "$HOME/todo_important"; then
echo -e "\e[1;34m$i\e[0m"
else
echo -e $i
fi
done < $HOME/todo
}
cat $HOME/notes/quotes #optional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment