docs/manual/guide/01-files-and-folders.org

61025559a3989ea7536dda296a9e27ddc7909aac
orgstar/docs/manual/guide/01-files-and-folders.org

461 lines · 43477 bytes

  1#+TITLE: Files, folders and buffers
  2#+DESCRIPTION: Adding folders, opening files, working with buffers, searching, saving, and how orgstar handles changes made outside it.
  3#+LEDE: orgstar works on folders of files you add to its sidebar, keeps each open file in a buffer, saves on its own, and merges changes other programs make to the same files.
  4
  5* The window
  6
  7orgstar has one main window, titled with the name of the buffer it shows. From left to right it holds:
  8
  9- the *sidebar*, listing the folders you added and the files in them;
 10- the *outline pane*, listing the headings of the open file, with the *backlinks pane* under it;
 11- the *editor*, with the optional tab bar above it and the modeline and echo area below it;
 12- the *inspector*, hidden by default, showing column view and clocked time.
 13
 14#+CAPTION: The main window: the sidebar, the outline pane with the backlinks pane under it, and the editor with the modeline.
 15[[file:../images/mac-window.png]]
 16
 17The toolbar holds a button that shows or hides the outline pane; Capture, Agenda and Commands (the command palette) buttons; a button that shows or hides the inspector; a progress indicator while orgstar indexes your folders, the running clock (see [[file:06-dates-and-clocking.org][Dates and clocking]]), a =Conflict= button when the open file has a conflict (see /Conflicts/ below), and the search field. View ▸ Customize Toolbar… adds, removes and moves the buttons.
 18
 19Help ▸ orgstar Manual opens this manual on the web, and Help ▸ Keys its key reference.
 20
 21The window title is the buffer name (see /Buffer names/ below). When the open file is not UTF-8, the subtitle reads =Read-only: not UTF-8=. The close button shows the unsaved-changes dot while any open buffer has unsaved edits.
 22
 23With no folders added, the editor area reads "Add a folder of org files". With folders but no open file, it reads "Choose a file" and suggests =⌘P=.
 24
 25The Agenda, Board, Clock Report and Capture windows are separate; they are covered in [[file:07-agenda.org][Agenda]], [[file:06-dates-and-clocking.org][Dates and clocking]] and [[file:08-capture.org][Capture]]. Closing the main window quits orgstar when no other window is open.
 26
 27** Menus and the command palette
 28
 29Most commands are in the menu bar. The =Org= menu lists every org command, each with the keys that run it in the current keymap; it is disabled when no file is open.
 30
 31File ▸ Command Palette… (=⇧⌘P=; =M-x= in the Emacs and Doom presets; =SPC := in Doom normal state) lists every command by title with its keys. Type to filter (characters match in order, as in Quick Open), then press =Return= to run the top match or click one. =Escape= closes it. Text movement and editing commands (forward character, kill line and so on) are not listed; they are only on keys.
 32
 33Several commands in this chapter are only in the palette, not in a menu: Close Other Buffers, Close All Buffers, Last Buffer and Show or Hide Tab Bar.
 34
 35** Showing and hiding panes
 36
 37| Menu item                                | Shortcut | Palette title                    |
 38|------------------------------------------+----------+----------------------------------|
 39| View ▸ Show Outline                      | =⌥⌘O=    | Show or Hide Outline             |
 40| View ▸ Show Backlinks                    |          | Show or Hide Backlinks           |
 41| View ▸ Show Inspector                    | =⌥⌘I=    | Show or Hide Inspector           |
 42| View ▸ Show Tab Bar                      |          | Show or Hide Tab Bar             |
 43
 44The toolbar's outline button does the same as View ▸ Show Outline. The sidebar is shown and hidden with the standard View menu command. The button at the right of the bar under it switches it between the files and an agenda; see [[file:07-agenda.org][The agenda]].
 45
 46orgstar remembers whether the outline, backlinks and inspector are shown. The outline pane's visibility is remembered for org files only: for other files it starts hidden each time you open one. Drag the divider on the outline pane's right edge to resize it (160 to 400 points; 220 by default). VoiceOver reads the divider as Outline width, which it adjusts in steps of 20 points.
 47
 48* Folders
 49
 50orgstar does not open a single folder like a project. You add any number of folders, called roots, and each appears as a section of the sidebar. orgstar indexes every org file in them for search, the agenda, refiling, backlinks and IDs.
 51
 52** Adding a folder
 53
 54Choose File ▸ Add Folder… (=⇧⌘O=), or click =+= at the bottom of the sidebar, and pick a folder. You can also drag folders from the Finder onto the sidebar. The first time orgstar opens with no folder, a welcome sheet offers the same, or a new =org= folder in iCloud Drive with a =notes.org= in it (in the Mac App Store version, a folder you choose or make in iCloud Drive), and the choice of keys; Get Started… in the empty window opens the sheet again. orgstar indexes it in the background; the toolbar shows a progress indicator while it works.
 55
 56orgstar keeps a bookmark to each folder, so a folder you move or rename in Finder is followed. If a folder can't be found at launch, orgstar reports =Can't find the folder PATH.= Adding a folder that is already in the sidebar does nothing.
 57
 58orgstar keeps the list of folders, the index and recovery versions in =~/Library/Application Support/Orgstar=; the Mac App Store version keeps them in =~/Library/Containers/sh.krz.orgstar/Data/Library/Application Support/Orgstar=.
 59
 60** Removing a folder
 61
 62Click =−= at the bottom of the sidebar and choose the folder, or right-click the folder's header and choose Remove from Sidebar…. Confirm with =Remove=. The folder and its files stay on disk; only orgstar's index entries for them are removed.
 63
 64** What the sidebar lists
 65
 66Each root is a collapsible section headed by the folder's name; hover over the name to see its full path. Roots are sorted by path. Inside a root, subfolders come first, then files, each sorted by name the way Finder sorts them. orgstar remembers which roots you collapsed.
 67
 68The sidebar lists every file in the folder, not only org files, with an icon for its kind:
 69
 70| Icon                  | File                                                       |
 71|-----------------------+------------------------------------------------------------|
 72| document              | =.org=                                                     |
 73| archive box           | =.org_archive=                                             |
 74| orange warning sign   | a Syncthing conflict copy (see /Syncthing conflict copies/ below) |
 75| photo                 | an image                                                   |
 76| rich document         | a PDF                                                      |
 77| play button           | audio or video                                             |
 78| =</>=                 | source code or a script                                    |
 79| plain document        | other text                                                 |
 80| cloud with arrow      | an iCloud file still downloading (see /iCloud/ below)       |
 81
 82Some files are never listed or indexed:
 83
 84- Emacs backups (names ending in =~=), auto-save files (names starting with =#=) and lock files (=.#name=);
 85- Syncthing's temporary files (=.syncthing.*=);
 86- orgstar's own temporary files (names containing =.orgstar-=);
 87- =.DS_Store= and =.localized=;
 88- anything inside these folders: =.git=, =.hg=, =.svn=, =.jj=, =.bzr=, =.stfolder=, =.stversions=, =.Trash=, =.Spotlight-V100=, =.fseventsd=, =.build=, =.venv=, =.cache=, =.tox=, =.mypy_cache=, =.pytest_cache=, =.gradle=, =.next=, =.terraform= and =node_modules=.
 89
 90Other dotfiles and dot folders are listed unless you turn off Settings ▸ General ▸ Show hidden files and folders (on by default). To change the list of ignored folders, set =ignored-folders= in =config.toml= to folder names separated by spaces; there is no control for it in Settings. See [[file:13-configuration.org][Configuration]].
 91
 92#+BEGIN_SRC toml
 93[orgstar]
 94show-hidden-files = true
 95ignored-folders = ".git .hg node_modules build"
 96#+END_SRC
 97
 98Org files (=.org= and =.org_archive=), Markdown files (=.md=, =.markdown=) and =.txt= files are read by the index. Only org files feed the agenda, IDs and links; Markdown and text files are searched, and their =denote:= links are read for backlinks (see [[file:09-links.org][Links]]). Other files are listed and can be opened, but their contents are not searched.
 99
100** Creating, renaming and trashing files
101
102Right-click a file or folder in the sidebar for:
103
104- New File… — creates a file in that folder (for a file, in the folder holding it). A name without an extension gets =.org=. A name like =projects/house= creates the =projects= folder too. Names can't start with =/= or contain =..=. The new file opens.
105- Rename… — renames the file or folder in place. The new name can't contain =/=. Open buffers of the file, or of files inside the folder, are saved first (in explicit save mode you are asked) and reopened under the new path.
106- Show in Finder.
107- Move to Trash… — moves the file or folder to the Trash after you confirm. Open buffers of it close without saving; the confirmation warns you when the file, or an open file inside the folder, has unsaved changes. You can put it back from the Trash in Finder.
108
109Right-click a root's header for New File…, Expand or Collapse, Show in Finder and Remove from Sidebar….
110
111File ▸ New File from Template… makes a new file from a template in =snippets.toml=, in a folder and with a name you choose; see [[file:02-the-editor.org][The editor]].
112
113* Opening files
114
115Click a file in the sidebar to open it. Other ways:
116
117- *Quick Open*: File ▸ Quick Open… (=⌘P=; =C-x C-f= in the Emacs and Doom presets; =SPC SPC=, =SPC .= or =SPC f f= in Doom normal state). Type part of a file's path below its root. Characters match in order, not necessarily next to each other; matches at the start of a word and runs of consecutive characters rank higher, and shorter paths win ties. Up to 50 matches show, with each file's name and path. The top match is selected; =↑= and =↓=, or =C-p= and =C-n=, move the selection. Press =Return= to open the selected match or click any match; =Escape= closes the list. Syncthing conflict copies are left out.
118- *Finder*: open an org file from Finder, with =open file.org= in Terminal, or by dropping it on orgstar's Dock icon. orgstar registers as the default app for org files and as an alternative editor for plain text. Each file opens as a buffer.
119- *Links*: following a =file:= link or an ID link opens the target file; see [[file:09-links.org][Links]].
120- *Doom ex command*: =:e FILE= opens =FILE=, relative to the current file's folder; =~= is expanded. A file that doesn't exist is reported as =No file FILE=.
121
122A file opened from Finder or by a link does not have to be inside one of your folders. In the Mac App Store version, a link to a file outside them first asks you to grant access to its folder (see [[file:../install.org][Install]]). Such a file is edited and saved normally, but it isn't listed in the sidebar, isn't indexed for search or the agenda, and isn't watched for outside changes (orgstar still merges outside changes when it saves; see /Saving/ below).
123
124orgstar has no Open Recent menu. Instead, it reopens the buffers that were open when you quit, in the same order, with the same file showing and each caret where you left it. Files that no longer exist are skipped.
125
126** Files that aren't org
127
128How a file opens depends on what it is:
129
130- *Org files* (=.org=, =.org_archive=) open in the editor with org editing.
131- *Markdown files* (=.md=, =.markdown=) open in the editor with Markdown highlighting, heading folds and an outline; see /Markdown/ below.
132- *Text files* open in the same editor as plain text. A file counts as text when macOS knows its type as text, or, for unknown types, when its first 8 KB are valid UTF-8 with no NUL bytes. Org commands, folding included, report =Not an org file=, and the outline pane shows "No outline" when you turn it on. Files in these languages get syntax highlighting: shell (=.sh=, =.bash=, =.zsh=, =.zshrc=, =.bashrc=, =.profile=), Python, Emacs Lisp, C, C++, R, JavaScript, Java, Scheme, Clojure, Haskell, Rust, Go, Ruby, JSON, YAML, TOML and Lua.
133- *Everything else* (images, PDFs, audio, video, archives, binary files) shows a Quick Look preview in place of the editor, with =Open with Default App= and =Show in Finder= buttons below it. The preview is not a buffer.
134
135Text files from Finder use orgstar only if you choose it with Open With, since orgstar is not their default app.
136
137** Markdown
138
139Markdown and plain text are a fallback, for notes kept in those formats next to org files, such as Denote's Markdown notes. orgstar edits them as text and doesn't convert them.
140
141In a Markdown file the editor styles:
142
143- ATX headings (=#= to =######=), in the theme's heading colours and sizes;
144- =**bold**=, =__bold__=, =*italic*=, =_italic_=, =~~strike-through~~= and =`code`=, with their markers in the markup colour;
145- links (=[text](url)=, =[text][label]=, =<url>=, bare =http://= and =https://= addresses, images and =[label]: url= definitions);
146- list bullets and numbers, task boxes (=[ ]=, =[x]=), block quotes, tables, rules (=---=, =***=, =___=) and =<!-- comments -->=;
147- fenced code (=```= or =~~~=) on the block band, highlighted when the fence names one of the languages above;
148- YAML (=---=) or TOML (=+++=) front matter at the top of the file, highlighted as YAML or TOML.
149
150Headings fold with the fold commands of /Folding/ in [[file:02-the-editor.org][The editor]]: =TAB= on a heading line, =S-TAB=, Doom's =z= keys, and a click on a heading's =#=s. A section runs to the next heading of the same or a higher level; a =#= line inside fenced code or front matter is not a heading. The outline pane lists the headings, and search finds them (see /Searching your notes/ below).
151
152Other org commands report =Not an org file= and change nothing, so none of them writes org syntax into the file. Among them: heading and list structure commands, TODO keywords, priorities, tags, properties, dates, tables, links and Insert Link, emphasis, checkbox toggling, clocking, refiling, archiving, attachments, encryption, Share Subtree, Copy as Rich Text and every export. Lint File says it works on Org files. Typing doesn't continue lists, pair brackets or fill paragraphs as it does in org files, dropped files aren't attached, and snippets don't expand. Commands that don't act on the file's own entries, such as the agenda, capture, search and Save, work as usual.
153
154Not supported in Markdown files: setext headings (a line underlined with === or ---), indented code blocks, HTML blocks, emphasis that spans lines, footnotes, a rendered preview, and Markdown versions of org's structure editing, agenda, capture and export.
155
156* Buffers
157
158Each open file is a buffer, as in Emacs. A buffer keeps its text, caret, folds, undo history and unsaved edits while another buffer is showing. Opening a file that already has a buffer shows that buffer. Two paths to the same file (through a symbolic link, for example) share one buffer, as =find-buffer-visiting= does.
159
160A new buffer is placed after the current one in the buffer order. Next and Previous Buffer follow that order and wrap around. Switch to Buffer and Last Buffer follow the order in which you last showed buffers.
161
162** Buffer commands
163
164| Command             | Menu, or palette                 | Mac               | Emacs preset                 | Doom (normal state)                       |
165|---------------------+----------------------------------+-------------------+------------------------------+-------------------------------------------|
166| Switch to Buffer…   | Window ▸ Switch to Buffer…       |                   | =C-x b=, =C-x C-b=           | =SPC b b=, =SPC b B=, =SPC ,=, =:b=, =:ls= |
167| Next Buffer         | Window ▸ Next Buffer             | =⇧⌘]=, =⌃Tab=     | =⇧⌘]=, =C-x <right>=          | =SPC b n=, =SPC b ]=, =] b=, =:bn=          |
168| Previous Buffer     | Window ▸ Previous Buffer         | =⇧⌘[=, =⌃⇧Tab=    | =⇧⌘[=, =C-x <left>=           | =SPC b p=, =SPC b [=, =[ b=, =:bp=          |
169| Last Buffer         | palette                          |                   |                              | =SPC `=                                   |
170| Close Buffer        | File ▸ Close Buffer              | =⌘W=              | =⌘W=, =C-x k=                 | =SPC b k=, =SPC b d=, =:bd=                 |
171| Close Other Buffers | palette                          |                   |                              | =SPC b O=                                 |
172| Close All Buffers   | palette                          |                   |                              | =SPC b K=                                 |
173
174Menu shortcuts (=⇧⌘]=, =⌘W= and the others) work in every preset. The Doom preset also has the Emacs preset's =C-x= keys in every state. The Mac preset's =⌃Tab= and =⌃⇧Tab= are in addition to the menu shortcuts.
175
176Switch to Buffer asks in the echo area. The choices are the open buffers, most recently shown first, with the current buffer last. Type to narrow them, =Tab= to complete the top choice, =Return= to switch, =Escape= to cancel.
177
178Close Buffer closes the current buffer and shows the buffer you showed before it. With no buffer open, =⌘W= closes the window. In a window split into panes, closing the last tab of a pane closes the pane; its buffer stays open when another pane shows it. In other windows (Agenda, Board and so on) =⌘W= closes that window. File ▸ Close Window (=⇧⌘W=) closes the window in front.
179
180When you close buffers with unsaved edits, what happens depends on the save mode (see /Saving/ below): in automatic mode they are saved first; in explicit mode orgstar asks =Save=, =Don't Save= or =Cancel= (=Save All= for several files). A buffer whose save fails or conflicts stays open.
181
182** Buffer names
183
184A buffer is named after its file. When two open files have the same name, each name gets as many of its folders as it takes to tell them apart, in angle brackets, as Emacs's uniquify does with =post-forward-angle-brackets=:
185
186#+BEGIN_SRC text
187notes.org<work>
188notes.org<home>
189notes.org<archive/2024>
190#+END_SRC
191
192These names show in the window title, the tab bar and Switch to Buffer.
193
194** The tab bar
195
196View ▸ Show Tab Bar shows a row of tabs above each pane, one per buffer that pane has shown, in the order it first showed them. It is off by default; the setting is =tab-bar= in =config.toml=.
197
198- Click a tab to show its buffer. Hover to see the file's full path.
199- Click =×= to close a buffer, in every pane. On a pane's last tab, with other panes in the window, it closes the pane as well, as Close Buffer does. A dot replaces the =×= while the buffer has unsaved edits; clicking it also closes the buffer, with the same unsaved-changes handling as Close Buffer.
200
201* Searching your notes
202
203The search field in the toolbar searches every org, Markdown and =.txt= file in your folders. Click it or choose Edit ▸ Search Notes (=⇧⌘F=; =SPC /= or =SPC s p= in Doom normal state) and type.
204
205While the field holds text, the outline pane shows the results in place of the outline. Each result is a heading, or a file when the match is in the text before its first heading, titled by its =#+TITLE= or its name. Under the title is the passage the words were found in, with them in bold, then the file's name. Click a result to open the file at that heading. Clear the field to get the outline back.
206
207How matching works:
208
209- orgstar searches heading titles, the text under each heading and the text before a file's first heading, in =.org= and =.org_archive= files, and in Markdown files by their =#= headings. A Markdown file's result for the text before its first heading is titled by the =title= in its front matter, else its first heading. A =.txt= file is searched as a whole and titled by its name, or a Denote note's by the =title:= in its front matter. Other files are not searched. Syncthing conflict copies are not searched.
210- Each word you type matches words that start with it, ignoring case and accents: =proj= finds =project= and =projection=.
211- Every word must match within the same heading, or within the text before the first heading.
212- Up to 50 results show, best matches first.
213- Open buffers with unsaved edits are searched as they are in the buffer, not as they are on disk.
214
215To find text inside the open file, use Edit ▸ Find (see [[file:02-the-editor.org][The editor]]).
216
217* The outline pane
218
219The outline pane lists the headings of the open org or Markdown file, indented by level. Headings without a title show as =(untitled)=. Click a heading to move the caret to it; folded headings around it unfold. A file without headings shows "No headings"; a file that is neither org nor Markdown shows "No outline".
220
221The outline follows your edits after a short pause in typing.
222
223** Backlinks
224
225Under the outline, the backlinks pane lists headings in your folders that link to the current file (a link before a file's first heading is listed under the file's name) (=Links to This File=) and to the heading at the caret (=Links to= followed by the heading's title). It updates as you move the caret. Click an entry to open it. Turn the pane off with View ▸ Show Backlinks. Which links count is covered in [[file:09-links.org][Links]].
226
227** Inspector
228
229View ▸ Show Inspector (=⌥⌘I=) opens the inspector, a pane on the right with column view and clocked time for the file or the current subtree. See [[file:04-outlines.org][Outlines]] and [[file:06-dates-and-clocking.org][Dates and clocking]].
230
231* Saving
232
233Settings ▸ General ▸ Save files has two modes; the =config.toml= setting is =save= in =[orgstar]=.
234
235- *Automatically, when typing stops* (=automatic=, the default). Each buffer saves one second after its last change, including buffers that are not showing. Quitting and closing buffers save without asking.
236- *Only with File ▸ Save (⌘S)* (=explicit=). Nothing is written until you save. Closing a buffer or quitting with unsaved edits asks first.
237
238| Command  | Menu                 | Shortcut | Emacs preset | Doom                                 |
239|----------+----------------------+----------+--------------+--------------------------------------|
240| Save     | File ▸ Save          | =⌘S=     | =C-x C-s=    | =SPC f s=, =SPC b s=, =:w=; =:wq= and =:x= save and close the window |
241| Save All | File ▸ Save All      | =⌥⌘S=    | =C-x s=      | =SPC b S=                            |
242
243Save is disabled for a read-only file. Save All is disabled when nothing is unsaved.
244
245The modeline shows a dot while the current buffer has unsaved edits. Buffers with unsaved edits show a dot in the tab bar.
246
247** How a save works
248
249orgstar does not assume it is the only program writing your files. Emacs, Syncthing, iCloud and Git may change them too. Each save:
250
2511. Reads the file on disk. If it has changed since orgstar last read or wrote it, orgstar merges those changes into the buffer first (see /External changes/ below). If they conflict with yours, nothing is written and the buffer has a conflict.
2522. Checks the file again, then writes the buffer to a temporary file in the same folder and replaces the original with it, so the file is never half-written.
2533. Reads the file back. If another program wrote it at the same moment, the version that lost goes to recovery and the other program's changes are merged where possible.
254
255Every version a save displaces goes to recovery first (see /Recovery versions/ below). Reads and writes go through macOS file coordination, so iCloud and other coordinating programs see a consistent file.
256
257A save keeps the file's encoding details: a UTF-8 byte order mark stays, and text you didn't change keeps its exact bytes, including CRLF line endings. Lines you add end in LF.
258
259* External changes
260
261orgstar watches the files in your folders. When a file with an open buffer changes on disk:
262
263- If the buffer has no unsaved edits, it reloads. The caret and folds stay where they were, mapped through the change.
264- If the buffer has unsaved edits, orgstar merges the change into the buffer line by line, against the version both started from. Lines changed on one side take that side; lines changed the same way on both sides are taken once. The merged buffer still has unsaved edits and saves as usual.
265- If both sides changed the same lines differently, the buffer has a conflict.
266
267Reloading or merging clears the buffer's undo history.
268
269If an open file is deleted on disk, its buffer stays open with its text. Saving it writes the file again.
270
271To throw away your unsaved edits and load the file as it is on disk, choose File ▸ Revert to File on Disk (also in the palette; =:e= in Doom). Your edits go to recovery.
272
273** Conflicts
274
275When a buffer conflicts with its file, automatic saving stops for that buffer, the =Conflict= button appears in the toolbar, and the conflict sheet opens. The sheet shows the differences: lines marked =-= are on disk, lines marked =+= are in your version, with three lines of context around each change. Removed lines are tinted in the theme's =todo= color and added lines in its =done= color. With Differentiate Without Color on in the system's accessibility settings, each changed line is also labelled Removed or Added; with Increase Contrast on, the tint is stronger and a bar marks each changed line. VoiceOver reads each changed line with Removed or Added before it. Choose:
276
277| Button             | What it does                                                                                                     |
278|--------------------+------------------------------------------------------------------------------------------------------------------|
279| Keep Mine          | Writes your version over the file. The disk version goes to recovery. This is the default button.               |
280| Use Disk Version   | Loads the file as it is on disk. Your version goes to recovery.                                                  |
281| Merge with Markers | Puts both sets of changes in the buffer, as =git merge= leaves a conflict: non-conflicting changes merged, conflicting lines between markers. Your version as it was goes to recovery. |
282| Cancel             | Closes the sheet. The conflict stays; click =Conflict= in the toolbar to reopen it.                              |
283
284After Merge with Markers the buffer holds blocks like this, which you edit and save:
285
286#+BEGIN_SRC text
287<<<<<<< yours
288- [ ] Call the plumber on Monday
289=======
290- [X] Call the plumber
291>>>>>>> disk
292#+END_SRC
293
294While a conflict is unresolved, saving that buffer does nothing except reopen the sheet.
295
296** Syncthing conflict copies
297
298When two devices change a file before Syncthing syncs them, Syncthing keeps one version as a conflict copy beside the file, named like =notes.sync-conflict-20260301-142233-ABCDEF7.org=. orgstar lists these in the sidebar in orange with a warning icon, and leaves them out of search, the agenda, ID lookup and Quick Open.
299
300When you open a file that has conflict copies, the echo area says how many there are. Choose File ▸ Resolve Sync Conflicts… to compare them. Pick a copy from the menu at the top; lines marked =-= are in the file (as the buffer holds it) and lines marked =+= are in the copy. Then choose:
301
302| Button             | What it does                                                                       |
303|--------------------+------------------------------------------------------------------------------------|
304| Keep File          | Leaves the buffer as it is.                                                        |
305| Use Copy           | Replaces the buffer's text with the copy's.                                        |
306| Merge with Markers | Puts every difference between the buffer and the copy between conflict markers, labelled with the two file names. There is no common base to merge against, so every difference is marked. |
307
308Each choice moves the copy to recovery and deletes it from the folder. The buffer changes as an edit you can undo, and is saved according to your save mode. When no copies are left the sheet closes.
309
310** Recovery versions
311
312Whenever orgstar replaces a version of a file, it keeps a copy: your buffer when you take the disk version, the disk version when you keep yours, a version another program wrote while orgstar saved, and resolved Syncthing copies. It also keeps a snapshot of the file as it was before a save, at most once an hour, so there is a version of your own writing to go back to. orgstar keeps the last 20 replaced versions and the last 10 snapshots per file in =~/Library/Application Support/Orgstar/Recovery= (in the Mac App Store version, the same folder inside its container).
313
314Choose File ▸ History… to see the open file's versions, newest first, each with its date and why it was kept:
315
316| Label                   | Meaning                                         |
317|-------------------------+-------------------------------------------------|
318| Your version, replaced  | Your buffer, before it was replaced             |
319| Disk version, replaced  | The file on disk, before orgstar wrote over it  |
320| Sync conflict copy      | A Syncthing conflict copy you resolved          |
321| Snapshot, before a save | The file as it was before a save                |
322
323In the download version, when the file is in a git repository, the list also has the commits that changed it, found with =git log --follow= so they reach past a rename, among the kept versions by date. A commit shows its subject, its short hash and its author.
324
325Select a version to see how it differs from the buffer (=-= in the buffer, =+= in the selected version). =Restore= puts that version's text in the buffer as one edit, which undo reverses; the buffer as it was goes to recovery first. Restoring a commit changes only the buffer: nothing is checked out, and the file is written by the next save as usual. =Show in Finder= reveals a kept file. For a file with no versions the sheet says so.
326
327** Committing to git
328
329The download version can commit your changes in a folder that is a git repository. It is off for every folder. In Settings ▸ Git, choose for each folder in the sidebar:
330
331| Choice                | What happens                                                                                     |
332|-----------------------+--------------------------------------------------------------------------------------------------|
333| Off                   | Nothing. The default.                                                                            |
334| Commit                | A minute after the last save in the folder, and when orgstar quits, orgstar commits the files it saved. |
335| Commit, Pull and Push | Before committing, =git pull --ff-only=; after the commit, =git push=.                          |
336
337Only the files orgstar wrote since the last commit are committed: files saved from a buffer, and files changed by refiling, archiving, capture and agenda commands. Other changes in the repository, staged or not, stay as they are, so your own work in progress is never committed. orgstar remembers these files until they are committed; files written before a crash are not committed. An encrypted =.org.gpg= file is committed as it is on disk, like any other file. A file that is ignored by =.gitignore=, or that is the same as in the last commit, is left out.
338
339The commit uses your git identity and configuration, including signing and hooks. Its message is =Update= followed by the file names, or =Update N files= with the paths in the body when there are more than three. The echo area says what was committed and pushed.
340
341orgstar runs the git it finds in =/opt/homebrew/bin=, =/usr/local/bin=, =/run/current-system/sw/bin= or on the =PATH= (=/usr/bin/git= only with the developer tools installed), or the one =ORGSTAR_GIT= names. It never asks for anything: a remote that needs a password or a host key confirmation fails, and the echo area says git couldn't sign in. Use an SSH key in the agent or a credential helper such as the keychain. Each git command is stopped after 30 seconds, or 60 for pull and push (15 when quitting).
342
343orgstar never merges, rebases or resolves a conflict:
344
345- When the pull can't fast-forward, because the remote and your repository both have commits or the remote changed a file you have changed, orgstar still commits locally, doesn't push, and says so. Pull and resolve it in a terminal (for example =git pull --rebase=).
346- While a merge, rebase, cherry-pick, revert or bisect is in progress, or another git command holds the index, orgstar doesn't run git in that repository. The files wait and are committed after the next save once it is finished.
347- A push runs only after the pull succeeded and something was committed.
348
349The Mac App Store version can't run git and has no Git pane.
350
351** iCloud
352
353Files in iCloud Drive that aren't downloaded to the Mac show in the sidebar with a cloud icon and grey text, with the tooltip "Downloading from iCloud". orgstar asks iCloud to download them, and indexes them and lets you open them when they arrive. Files iCloud removes from the Mac to save space keep their index entries until they are back, so search and the agenda still find them.
354
355* Handoff
356
357A file open in the editor can be continued on another Mac, iPhone or iPad signed in to the same Apple Account, with Handoff turned on in each device's settings. The other device shows orgstar's icon in the Dock or the app switcher; choosing it opens the same file in its editor, at the same place.
358
359What is passed is where the file is and where the caret is, never the file's text:
360
361- the name of the added folder the file is in, the file's path inside iCloud when it is in iCloud Drive, and its path inside the folder;
362- the caret's heading (its =ID= when it has one, and the titles of it and the headings above it) and line.
363
364The other device looks for the file in its own added folders. A folder in iCloud Drive is matched by its path in iCloud Drive, which is the same on every device, so it is found even when another folder has the same name; an added folder higher up in iCloud Drive holds the file too. Any other folder, such as one kept by Dropbox, Syncthing or Working Copy, is at a different path on each device and is matched by its name: add it with the same name on both. The caret goes to the heading with that =ID=, or else the heading at that outline path, on the same line within it as on the other device; when neither is found, to the same line of the file. When the device has no folder of that name, or the folder doesn't have the file yet, orgstar says so and opens nothing.
365
366Only files in an added folder are offered, and never an encrypted =.org.gpg= file. On iPhone and iPad, the editor offers its file; the reader and the agenda don't.
367
368* Sharing a subtree
369
370File ▸ Share Subtree… (also in the command palette, and in Commands on iPhone and iPad, under Export) sends the entry at the caret through AirDrop, Mail, Messages or another app:
371
372- Org file :: the entry as an =.org= file named after its heading. The file holds the keyword lines at the top of your file (such as =#+TODO= and =#+STARTUP=, but not =#+TITLE=) and the entry with everything under it, as it is in the file, promoted so the entry is a level-1 heading.
373- Text :: the same text, for an app that takes text.
374
375When the entry or an entry under it has attachments, Include attachments sends each attached file as an item of its own beside the =.org= file. =attachment:= links in the shared file don't reach them on the other side, since the attachment folder isn't sent.
376
377An encrypted entry (=:crypt:=) is shared as the file holds it, still encrypted.
378
379* Importing Markdown and Obsidian
380
381File ▸ Import ▸ Markdown Files… and File ▸ Import ▸ Obsidian Vault… (also in the command palette) convert Markdown to new org files in one of your folders. The source is only read.
382
3831. Choose the source: Markdown files or folders of them (=.md=, =.markdown=), or a vault's folder.
3842. Choose the folder to import into from the folders in the sidebar and the folders inside them.
3853. The preview counts the files, headings, links and attachments, lists names that were already taken, and lists what couldn't be converted or was converted with a loss. Import writes the files; Cancel writes nothing.
386
387Where files go:
388
389- A chosen file becomes =name.org= in the folder.
390- A chosen folder or vault becomes a new folder of the same name, with each note at the same path inside it. Hidden files and folders (=.obsidian=, =.trash=) are skipped.
391- An existing file or folder is never replaced. A name already taken gets a number: =note 2.org=, =Vault 2=. The preview lists these; if a name is taken between the preview and Import, the message after the import lists it too.
392- Files a note links to or embeds (images, PDFs) are copied: a folder's at the same path inside the new folder, so a vault's attachment folder is kept; a chosen file's into =attachments= in the folder. Files nothing links to are not copied.
393- Each file is written to a temporary name and renamed into place, so a file is there whole or not at all.
394
395The conversion reads files in the background; a vault of 1,000 notes takes a few seconds.
396
397** What is converted
398
399| Markdown                                     | Org                                                       |
400|----------------------------------------------+-----------------------------------------------------------|
401| =#= headings and underlined headings         | =*= headings, the same level                              |
402| =**bold**=, =*italic*=, =~~strike~~=, =`code`= | =*bold*=, =/italic/=, =+strike+=, =~code~= (verbatim when the code holds a tilde) |
403| =[text](url)=, reference links, =<url>=      | =[[url][text]]=                                           |
404| =![alt](image.png)=                          | =[[file:image.png]]=; on its own line, with =#+attr_html: :alt alt= |
405| lists, nested, numbered, =- [ ]= tasks       | org lists; a list starting at 3 gets =[@3]=; =[x]= is =[X]=, =[/]= is =[-]= |
406| =>= quotes                                   | =#+begin_quote= blocks                                    |
407| fenced code with a language                  | =#+begin_src lang=; without one, and indented code, =#+begin_example= |
408| tables                                       | org tables; an escaped pipe in a cell becomes =\vert{}=    |
409| =[^1]= footnotes                             | =[fn:1]=, the definitions at the end of the file          |
410| =$$…$$= and =$…$=                            | =\[…\]= and =\(…\)=                                       |
411| HTML blocks, =<!-- -->=                      | =#+begin_export html=, =#+begin_comment=                  |
412| two trailing spaces or =\= at a line's end   | =\\=                                                      |
413
414YAML front matter becomes the top of the file:
415
416- =title= → =#+title:=; =date= → =#+date:=; =tags= → =#+filetags:=.
417- =aliases= → =ROAM_ALIASES= in a property drawer at the top of the file.
418- Every other key → a property in that drawer, under its own name. A list becomes space-separated values, quoted when they contain spaces, as org's multivalued properties are.
419
420Tag characters org doesn't allow, such as =/= and =-=, become =_=: =work/meetings= is =work_meetings=.
421
422Obsidian vaults also get:
423
424- =[[Note]]= and =[[Note|text]]= → =file:= links to the converted file, relative to the file holding the link. A note is found by name anywhere in the vault, as Obsidian does; the shortest path wins. =file:= links rather than =id:= links, so no =ID= properties are added and the links work in Emacs without an ID database.
425- =[[Note#Heading]]= → =file:Note.org::*Heading=; =[[Note#^id]]= → =file:Note.org::id=, with the block's =^id= written as the target =<<id>>=; =[[#Heading]]= → =[[*Heading]]=.
426- =![[image.png]]= → =[[file:…/image.png]]=, shown as an image; =![[image.png|300]]= on its own line adds =#+attr_org: :width 300=. Other embedded files and embedded notes → links.
427- =#tags= in the text stay as text and are added as tags: to the heading whose section they are in, or to =#+filetags:= before the first heading. Tags at the end of a heading line move to its tags.
428- => [!note] Title= callouts → =#+begin_note= special blocks with the title as a bold first line. =example= and other names org reserves get =callout-= in front: =#+begin_callout-example=.
429- The Tasks plugin's =📅 date=, =⏳ date= and =✅ date= → =DEADLINE: <date>=, =SCHEDULED: <date>= and =CLOSED: [date]= in the item's text; =🛫= and =➕= dates → timestamps. The agenda shows them as timestamps on that day, not as deadlines, since only headings have planning lines in org.
430- Highlights (two equals signs on each side) → bold; =%% comments %%= on their own lines → =#+begin_comment=.
431- A note without a =title= gets the file name as =#+title:=.
432
433** Not supported
434
435- Wikilinks to notes that don't exist are written as links to where the note would be (=file:Missing.org=) and listed in the preview.
436- Links to Markdown files not among those imported keep their =.md= path and are listed.
437- Canvas (=.canvas=) and base (=.base=) files are skipped and listed.
438- Front matter keys holding a nested map are left out and listed.
439- Tasks plugin recurrences (=🔁=) stay as text; custom task statuses other than =x= and =/= become open checkboxes; both are listed.
440- Headings inside a list or quote become bold lines.
441- Table column alignment, link titles and image alt text inside paragraphs are dropped.
442- Emphasis inside a word (=foo**bar**baz=) is converted, but org shows it as emphasis only next to spaces or punctuation.
443- Text that org reads as markup, such as a word between slashes, may show as emphasis.
444- Inline HTML is kept as =@@html:…@@=; Obsidian's inline =%%comments%%= stay as text.
445- Files that aren't UTF-8 are skipped and listed.
446- Importing is on the Mac only.
447
448* Encodings and line endings
449
450orgstar edits UTF-8 files, with or without a byte order mark.
451
452- A file that is not valid UTF-8 opens read-only. Its text shows with replacement characters where bytes don't decode, the window subtitle reads =Read-only: not UTF-8=, the modeline shows =Read-only=, and commands that would change it report =This file is read-only.= orgstar never writes such a file, and refiling or archiving into it is refused.
453- A file with a UTF-8 byte order mark keeps it when saved; the modeline shows =BOM=.
454- A file containing CRLF line endings shows =CRLF= in the modeline. Existing line endings are kept.
455- LaTeX export, and =#+INCLUDE= in every export, read line endings as Emacs does: a file whose lines all end in CRLF, or all in CR, is read as LF lines; in a file with mixed endings the CRs stay in the text.
456
457orgstar does not convert between encodings or line endings.
458
459* On iOS
460
461The iOS app adds folders from its Folders screen and lists only org, Markdown and =.txt= files there. Conflicts, Syncthing copies and recovery versions are in the editor's menu; the iOS app doesn't list git commits, and commits, pulls and pushes a git folder through the Working Copy app. Files are watched through file presenters rather than FSEvents. See [[file:14-ios.org][iOS]].
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form