How to bookmark lines in a text file on Mac
You can do this with Note My. Mark the lines that matter, walk between the marks, and act on the whole set at once — instead of re-running the same search to find the six you cared about.
Working through a long file, you keep landing on the same handful of lines. The failing assertion. The two places a constant is set. Scrolling back to them is slow, and re-running the same search is slower still — a search takes you to every match, not to the six you actually cared about.
Note My solves exactly that with bookmarks. You mark a line, the mark stays where it is, and two keys walk you up and down the marked lines however far apart they are. This guide covers marking, walking, bulk-marking from a search, and the commands that act on every bookmarked line at once.
A bookmark is a mark on screen, not a change to your text. Marking a line inserts no character and edits nothing — the dot sits in the gutter, not in the file.
What a bookmark is here
A bookmark in Note My is a whole line, flagged, with a dot drawn beside its number in the gutter. The gutter — the line-number ruler down the left edge — is the one surface that carries all of this: the numbers themselves, the fold arrows beside foldable blocks, and the bookmark dots. It comes in four styles, chosen under Settings ▸ Ruler: Classic (the default), Recessed, Edge and Cadence.
What you get is a set of marked lines you move between with two keys, and every other bookmark command acts on that same set — walk it, copy it, delete it, invert it. One set, one strip of gutter, one pair of keys, however long the file runs.
All of it stays on your Mac: no upload, no account, no file leaving the machine.
Mark a line and move between marks
-
Put the caret on the line and press ⌘F2
That is Search ▸ Toggle Bookmark. It toggles: press it on a line that is already bookmarked and the mark comes off. A dot appears beside the line number as soon as the mark goes on.
Nothing about the document changes. The line is not edited and no text is inserted — the dot lives in the gutter, next to the number, and not in the file.
-
Or right-click in the gutter
Right-clicking a line number puts the bookmark command straight onto that line, reading "Add Bookmark to Line N" on an unmarked line and "Remove Bookmark from Line N" on a marked one — with the real number in place of N, so you can see which line you are about to affect before you commit to it.
Use this when you are reading with the mouse. The menu acts on the line you clicked — the one it names — rather than on the line the caret happens to be on.
-
Walk the marks with F2 and ⇧F2
Search ▸ Next Bookmark is F2; Search ▸ Previous Bookmark is ⇧F2. They move the caret to the next and previous marked line. Because both sit on bare function keys, you can walk a file one-handed while reading.
This pairs well with ⌘L for Search ▸ Go to Line…, which arrives pre-filled with the line you are on, selected — so it also answers "where am I?" before you start marking.
-
Clear them when you are done
The same menu block carries a Clear command, which removes every bookmark in the document at once. Nothing is lost by it — clearing marks does not touch a character of text.
None of this changes when the file is enormous. Our large-file engine keeps a multi-megabyte log open and editable, so marking lines in one works exactly as it does in a short file — same shortcut, same dots, same two keys to walk between them.
Bookmark every search match at once
The slow way to mark twelve occurrences of a string is to search for each one and press ⌘F2. The fast way is to let the search do it.
Open Find & Replace from the magnifying-glass button in the toolbar, type your query, and press Bookmark All — one of the pop-over's seven buttons, and the only one given a row of its own, after Find Next, Find Previous and Find All. Every match in scope gets its line marked. The same command is on the Search menu as Bookmark All Search Matches, ⌥⌘B.
The magnifying-glass button in the toolbar is the one that opens Find & Replace, the pop-over carrying Bookmark All. ⌘F opens the system find bar, a separate piece of UI for a quick look-up.
Two controls decide what gets marked, and both are worth setting before you press the button. The scope control is segmented This File / All Tabs, so a single press can mark the matching lines in the file in front of you or across every file you have open. The options are Case Sensitive, Whole Word and Regular Expression, which is what makes the query as precise as the job needs: whole-word matching to catch a short variable name without catching every longer word that contains those letters, and a regular expression to mark every line that opens a function, every timestamp inside the hour you care about, or every TODO however it was spelled.
Our find and replace is the tool for this. Tune the query until the match count is about the size of the set you want to walk, press Bookmark All once, and you have a set to step through for the rest of the session. Marked more than you meant to? Clear resets the gutter and you can search again with a tighter query — nothing you tried on the way there has touched the text.
Acting on the whole marked set
Once a set of lines is marked, three commands treat it as one thing.
| Command | What it does |
|---|---|
| Copy Bookmarked Lines | Puts every marked line on the clipboard, so you can lift the interesting lines out of a long file into a new tab or a message. |
| Delete Bookmarked Lines | Removes every marked line from the document. This one edits the text. |
| Invert Bookmarks With Matches | Inverts the marked set against the current search matches — the way to flip a pass round and work through the matches you did not mark. It works from your current query, so the gutter shows you the new shape of the set as soon as it runs. |
Deletion is the one that edits, so it asks first. A confirmation is shown before the lines go, controlled by a setting that is on by default. If you run the same pass file after file and the sheet is in your way, you can switch the confirmation off in Settings ▸ Bookmarks; leaving it on gives you one last look at the gutter before the lines go, which is the calmer way to work through a file you care about.
The Bookmarks settings pane
Press ⌘, and choose Bookmarks, one of the fourteen settings panes. It carries the two switches that decide how bookmarks sit around you as you work: whether the bookmark chip appears in the status bar, and whether deleting bookmarked lines asks first. The chip rides along with the general status-pill switch, so keep the status-bar pills on, switch the bookmark chip on, and it sits quietly in the status bar while you work.
If you cannot remember which pane a row lives in, type into the sidebar search field: it searches every row in the window and flashes the one you pick.
Replaying a marking pass with a macro
Our macro recorder covers bookmark toggling, next bookmark and previous bookmark. So a routine you perform on file after file — go to a line, mark it, move down, mark again — can be recorded once and replayed on the next file.
Start with Macro ▸ Start Recording (⌥⌘R), do the pass by hand, and stop with ⌥⇧⌘R. A glass pill with a pulsing red dot sits at the top of the window while recording, counting the actions as they land. Play it back with ⌥⌘P, or use Macro ▸ Playback Multiple Times… for between 1 and 9,999 iterations — anything above 50 asks you to confirm first.
Two details make this safe to lean on. Playback asks whether to run on the current tab or on all open tabs, so a pass meant for one file stays there. And one ⌘Z takes back a whole playback run — you do not press undo once per action. Work the pass out by hand on the first file, and it is a single keystroke on every file after it.
Troubleshooting
F2 changes the screen brightness instead of moving
That is the Mac's function-key setting, not the editor. On a keyboard where the top row acts as media and brightness keys, the plain key sends the media action and the function key needs fn held with it. Hold fn and press F2, or change the behaviour of the top row in macOS keyboard settings.
Nothing happens when I press F2
Most likely there is nothing marked for it to move to. The dots in the gutter are the check: if there are none, F2 has nowhere to go. Mark a line with ⌘F2 first and try again.
I want to check the set before I act on it
The gutter is the record. Every marked line carries a dot beside its number, so running your eye down the ruler tells you the size and shape of the set before you copy it or delete it. If a dot is somewhere you did not intend, ⌘F2 takes it off again, and Clear resets the whole set so you can make the pass afresh.
I cannot see the dots
The dots are drawn in the line-number gutter, so anything that makes the gutter hard to read makes them hard to spot. Try another ruler style under Settings ▸ Ruler: the four differ in how the gutter is drawn, including the strength of the current-line band and the width of the accent bar, so a dot that disappears against one style stands out against another.
I want to take the marked lines with me
Marking a line writes nothing into the document, which is what makes bookmarks safe to use as freely as you like — and when a set needs to travel, Copy Bookmarked Lines lifts it straight out. Every marked line goes to the clipboard as text, so a message, a note or a colleague's hands can have the findings without the file around them. Paste into a new tab, tidy the list there, and save it as the record of the pass; the file you were reading stays exactly as you found it.
Bookmarks alongside the rest of the gutter
The gutter earns its width. Line numbers, fold arrows and bookmark dots share the same strip of screen, so one glance tells you where you are, what is collapsed and what you have marked. The tools stack rather than compete: fold away the blocks you have finished with, mark the lines you keep coming back to, and a long file gets shorter and easier to move around at the same time. Folding is a double-click on a brace, marking is ⌘F2, and each leaves the other exactly as it was.
- Mark across every open file. Bookmark All follows the scope control in Find & Replace, so set it to All Tabs and one press marks the matching lines in every file you have open.
- Find your place first. ⌘L opens Search ▸ Go to Line… pre-filled with the line you are on, which is the quickest way to answer "where am I?" before you start a marking pass.
- Survey a whole tree. Search ▸ Find in Folder… (⇧⌘F) searches a directory in its own window and only ever reads — nothing on disk is touched. Open whichever file looks right, then mark it up.
- Sweep a log, then keep what you found. ⌥⌘E and ⌥⇧⌘E step between lines containing FATAL, CRITICAL, SEVERE, ERROR, WARNING or WARN. Press ⌘F2 on the ones worth returning to, and a sweep becomes a set you can walk all afternoon.
- Make the dots easy to spot. The four ruler styles under Settings ▸ Ruler — Classic, Recessed, Edge and Cadence — draw the gutter differently, so you can pick the one that shows your marks most clearly on your display.
Frequently asked questions
What is the shortcut to bookmark a line?
⌘F2 toggles a bookmark on the line the caret is on. F2 goes to the next bookmark and ⇧F2 to the previous one. All three are on the Search menu.
Can I bookmark every line that contains a word?
Yes. Search for the word in the Find & Replace pop-over and press Bookmark All, or use Search ▸ Bookmark All Search Matches (⌥⌘B). The search options include whole-word matching and regular expressions, so the query can be as precise as you need.
How do I delete every line I have marked?
Use Delete Bookmarked Lines on the Search menu. It asks for confirmation first — that confirmation is on by default and can be switched off in Settings ▸ Bookmarks. Unlike marking, this one genuinely edits the document.
Do bookmarks change the file?
Your text stays exactly as you wrote it. Marking, clearing and walking bookmarks never touch a character — the dot is drawn in the gutter beside the line number, not inserted into the line. Delete Bookmarked Lines is the one command that edits the document, and it asks before it does.
How do I get a list of every line I have marked?
Use Copy Bookmarked Lines. It puts the text of every marked line on the clipboard, so pasting into a new tab gives you the list in front of you — the contents rather than just the numbers, ready to save, send or work through on its own.
How is this different from jumping between errors in a log?
Bookmarks are lines you chose. Error jumping picks the lines for you: ⌥⌘E and ⌥⇧⌘E move to the next and previous line containing FATAL, CRITICAL, SEVERE, ERROR, WARNING or WARN, whatever the case, wrapping at the end. Survey a log with error jumps; keep what you found with bookmarks.