Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm editing a note, then I get a call from my ADHD and I go to look at another note. Is there no way to get back to the previous note? I'm looking for previous/next like in a browser (or any other program, these days)...

share|improve this question
You could try abusing the bookmarks feature to store what note you're viewing, then return later and remove from bookmarks. – Daniel Beck Oct 23 '11 at 2:57
Thanks @DanielBeck, my concern is that I usually realize that I want to go back AFTER I've gone forward :) – Dan Rosenstark Oct 23 '11 at 17:39
up vote 1 down vote accepted

The developer of Notational Velocity in a comment to #64: Simple: Jump back to last note, Advanced: Browsing history - Issues - scrod/nv - GitHub:

How would NV determine what the "last" note was? Would that be the last note edited? The last note where the editor had focus? The last note selected? How would it differentiate between selecting a series of notes using Command-J/K, the left/right keys, or dragging across them with the mouse?

I've tried writing AppleScripts that were based on the modification date of the external text files for notes. But that had a few additional issues, and the scripts were pretty unintuitive to use.

The best workaround I've come up with:

~/Library/Scripts/Applications/nvALT/jump.scpt, ⌃␣ in FastScripts

tell application "System Events" to tell process "nvALT"
    set p to value of text field 1 of group 1 of tool bar 1 of window 1
end tell
set x to do shell script "cd /1
/bin/ls -t |
grep -v '^Interim Note-Changes$' |
grep -v '^Notes & Settings$' |
grep '^'" & quoted form of p & "'.txt$' -B 1 |
grep -v '^'" & quoted form of p & "'.txt$' |
sed 's|\\.txt$||'"
open location "nv://" & x
delay 0.1
tell application "System Events" to keystroke return
  • If the most recently modified note is not selected, open it
  • Otherwise open the second most recently modified note

NV doesn't save changes to external files immediately. (It takes about 5 to 10 seconds from the first edit.) Most of the time that's not a problem though.

Another (and probably the best) option would be to sort Notational Velocity's note list by Date Modified. Then for example pressing ⎋↓↓↩ would go to the second most recently modified note.

share|improve this answer
Thanks @Lri, great answer. So all of these depend on you actually modify the notes, right? – Dan Rosenstark Oct 23 '11 at 15:37
@Yar Yeah. You can't sort by "date last opened" in NV. And the external files don't have any metadata for that either. – user495470 Oct 23 '11 at 20:06
Thanks @Lri, that make sense... were I building (or modifying) NV, I definitely would not make that data persistent. It would just be a stack of the notes that have shown up in the editing pane. – Dan Rosenstark Oct 23 '11 at 21:34

I've done something fairly similar, but rely on the last added attribute of a directory rather than the Note and Settings file, since it can be slow to update. Here's a quick script you can take advantage of with any directory

FOLDER="$HOME/Dropbox/My Notes"

RECENT=$(mdls -name kMDItemFSName -name kMDItemDateAdded $FOLDER/* | \
    sed 'N;s/\n//' | \
    awk '{print $3 " " $4 " " substr($0,index($0,$7))}' | \
    sort -r | \
    cut -d'"' -f2 | \
    head -n1)


Now you can open NVAlt or reveal the file with

# Open in NVAlt
open "nvalt://$RECENT"

# Reveal in Finder
open -R "$FULLPATH"
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .