-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"notes recent" command to show recently edited notes #52
Comments
I'm potentially open to something like this, although I'd like to dig into the details a little. What exactly would Depending on what you're looking for, one interesting alternative would be to add a It feels a little more powerful to add it to the existing commands, rather create a whole new separate command. Alternatively, you could have a standalone command for it? Maybe something like |
My basic use case is that I want to open one of the notes that I edited yesterday, but I can't remember what I called it. For this case, I'm more concerned with speed (i.e., less thinking/typing) than with flexibility and power, so just listing the last five notes in reverse chronological order would be sufficient. I'll look at the output, and then run If you'd prefer to keep things general, then printing all the notes with a command like |
I'd suggest a .notes-history file somewhere, then head append latest files opened |
How about a |
That would require date & time stamps on all the openings, might be tricky to implement |
@primis maintaining a '.notes-history' file will add overhead costs to creating and opening files(I think), got different approach?. |
If your filesystem doesn't have If you're using |
I would also like to have this feature, but as this conversation has been stale for awhile, I put together my own little solution and made myself a new command: "lsm" )
for f in $(ls -pt "$notes_dir"); do
printf "%s %s %s\n" "$f" $(date -r "$notes_dir/$f" "+%Y-%m-%d %H:%M:%S")
done | column -t
;; So now I can do $ n lsm
contr.md 2023-06-26 20:02:46
summ.md 2023-06-26 18:50:01
td_c.md 2023-01-02 13:57:17 to see the notes in last modified order. "lsm" )
ls -lt "$notes_dir"
;; results in $ n lsm
total 32
-rwxrwxrwx 1 fraasi fraasi 113 Jun 26 20:02 contr.md
-rwxrwxrwx 1 fraasi fraasi 122 Jun 26 18:50 summ.md
-rwxrwxrwx 1 fraasi fraasi 343 Jan 2 2023 td_c.md |
I should have shared my solution from years ago! recent_notes() {
if [ "$#" -gt 0 ]; then
count="$*"
else
count=1
fi
find $NOTES_DIRECTORY -type f -name "*.$NOTES_EXT" -printf '%T@ %P\n' | sort -n -r | awk '{print $2}' | head -n $count
}
I bound this to |
It would be nice if I could see the notes I've recently edited (or perhaps even the ones I've recently accessed), with a command like
notes recent
. I may take a whack at this myself and submit a PR, but am interested in hearing thoughts on this before I go off coding.The text was updated successfully, but these errors were encountered: