Links, IDs and attachments
Table of Contents
- 1. How to use this file
- 2. Anatomy of a link
- 3. Following links
- 4. Moving between links
- 5. Internal links
- 6. Radio targets
- 7. File links
- 8. Web and other external links
- 9. Link abbreviations
#+LINK: - 10. Storing and inserting links
- 11. IDs
- 12. Attachments
- 13. Custom link types
- 14. What is not supported
- 15. Further reading
1. How to use this file
Links turn an Org file into a web of notes: a link can point to a heading of
this file, to a line of another file, to a web page, to a heading with an
ID wherever it lives, or to a file attached to an entry. This file shows
every link type org.nvim supports, how to follow, store and insert links,
and how IDs and attachments work. Almost every example is a real, clickable
link: press <CR> on it and see where you land.
- The file starts folded (
#+STARTUP: overview). Put the cursor on a heading and press<Tab>to open it;<S-Tab>cycles the whole buffer. <prefix>means your org prefix,<leader>oby default (so<prefix>liis<Space>oliwith the bundled init file).uundoes any edit;git checkout examples/13-links.orgrestores the file. The attachment exercises create files underexamples/data/: remove them withrm -rf examples/datawhen you are done.g?lists every key of the buffer;/linkin that list finds the link keys.:Org lintchecks the file. It reports a few links here on purpose: deliberately broken ones,id:...::searchlinks, a wildcard and a URL-encoded abbreviation. Comments next to them say so.- Lines starting with Try: are exercises, Expect: says what you should see. Lines starting with =# = are Org comments: they explain the example next to them and are never exported.
Start Neovim from the repository root with the bundled init file, which
sets the agenda files to examples/*.org (the ID links below search those
files), keeps the ID database in a scratch directory and never touches your
own notes:
nvim -u examples/minimal_init.lua examples/13-links.org
After following a link to another place, <C-o> (or <C-c>&) brings you
back here, so you can wander freely.
1.1. Keys in this file
Emacs keys work too: C-c C-o opens, C-c C-l inserts, C-c l stores,
C-c M-l / C-c C-M-l insert the last / all stored links, C-c C-x C-n
and C-c C-x C-p move between links, C-c C-a attaches.
| Key | What it does |
|---|---|
<CR> gx <prefix>o |
open the link under the cursor |
<C-c><C-o> on a heading |
pick one of the entry's links |
<C-o> or <C-c>& |
jump back after following a link |
<prefix>ln <prefix>lp |
next / previous link |
<prefix>lt |
show / hide the raw link text |
<prefix>ls |
store a link to this place (any buffer) |
<prefix>li |
insert a link, or edit the one here |
<prefix>lL |
insert the last stored link |
<prefix>lA |
insert all stored links |
<prefix>lI |
get or create the entry's ID |
<prefix>lg |
go to an entry by ID |
<prefix>ly |
copy the entry's ID |
<prefix>A |
attachment menu |
<prefix>' |
on a link: follow it |
<C-x><C-o> after [[ |
complete link types, headings, custom IDs |
2. Anatomy of a link
An Org link has one of three shapes:
- A bracket link with a description:
[[target][description]]. Only the description is shown; the target is hidden (concealed). - A bracket link without a description:
[[target]]. The target is shown. - A plain link: a URL written as it is, such as
https://orgmode.org, or an angle link like<https://orgmode.org>.
Examples, one per line:
- https://github.com/xheisenbugx/org.nvimand more text
A bracket link may even span two lines, like this one: the section about following links.
2.1. Seeing the raw text
By default org.nvim conceals the brackets and the target of described links
(the ui.conceal_links option, Emacs' org-link-descriptive). The cursor
line still shows the full text in Insert mode, and <prefix>lt toggles the
concealment for the whole buffer (links only: emphasis markers stay as they
are).
Try: press <prefix>lt now.
Expect: the first example above now reads
[[https://orgmode.org/manual/][the Org manual]] in full. Press
<prefix>lt again and it shrinks back to "the Org manual".
2.2. What is not a link
Link syntax inside verbatim or code markup, comment lines and blocks is
not a link for Org: it is not exported as a link and <prefix>ln (next
link) skips it.
- In
verbatim [[*Anatomy of a link]]orcode https://x.orga link is text.
[[*Anatomy of a link]] <- inside an example block: not a link either
The real link: 2.
Try: put the cursor on the heading "What is not a link" and press
<prefix>ln.
Expect: the cursor skips the three fake links and lands on the [[ of
the real link in the line "The real link: …". (In org.nvim, <CR> on
the text of a fake link still follows it.)
3. Following links
<CR>, gx and <prefix>o all run the same action, open_at_point
(Emacs C-c C-o). It opens whatever is under the cursor: a link, a
footnote reference or a timestamp (which opens the agenda for that day).
- Web and mail links open in the system browser / mail client
(
vim.ui.open()). - File and ID links open the file in another window, splitting the
screen when there is only one (
links.frame_setup). - Internal links (headings, targets, custom IDs) move the cursor inside the current buffer.
After an internal jump, <C-o> goes back (org.nvim records the jump in the
jumplist), and <C-c>& does the same like Emacs' mark ring.
3.1. Counts change where things open
| Key | Emacs | Effect |
|---|---|---|
<CR> |
C-c C-o |
normal behaviour |
4<CR> |
C-u C-c C-o |
internal links: in another window; |
| files: always in Neovim | ||
16<CR> |
C-u C-u ... |
files: always with the system application |
Try: on the link Radio targets press 4<CR>.
Expect: the window splits; the new window shows the "Radio targets"
heading, the old one stays here. Close it with :q.
3.2. Links of a headline: <C-c><C-o>
On a headline (not on a link), <C-c><C-o> lists the links in the entry
and lets you pick one, or "Open all links". On the tags of a headline it
opens a tags agenda for the tag under the cursor instead.
3.2.1. Three links in one entry  demo links
Try: put the cursor on the words "Three links in one entry" and press
<C-c><C-o>.
Expect: a menu with the three links and "Open all links". Pick "Anatomy": the cursor lands on "* Anatomy of a link".
Try: now put the cursor on the demo tag of that headline and press
<C-c><C-o>.
Expect: an agenda "Headlines with TAGS match: demo" listing
"links: Three links in one entry" (and the entries tagged demo in the
other example files). Press q to close it.
3.3. Following a link from <prefix>'
<prefix>' (C-c ', the "edit special" key) follows the link under the
cursor too, which is handy if you have remapped <CR>.
Try: on this link press <prefix>'.
Expect: the cursor is on "* Anatomy of a link". <C-o> comes back.
4. Moving between links
<prefix>ln and <prefix>lp (Emacs C-c C-x C-n / C-c C-x C-p) jump to
the next and previous link. They skip links in source and example blocks,
comments and verbatim text. A count jumps over several links, and when no
link is left, pressing the key again wraps around the buffer.
- Link one: 2 and link two: https://neovim.io
- Link three: Following links
- Link four: https://orgmode.org
Try: put the cursor on "Link one" and press <prefix>ln four times.
Expect: the cursor lands on the start of each link in turn: the [[ of
link one, the h of the URL of link two, the [[ of link three and the
< of link four. Then press <prefix>lp to walk back. 2<prefix>ln
skips a link.
5. Internal links
Internal links point into the current file. Their target decides what they search for:
| Target | Finds |
|---|---|
*Heading text |
a headline with exactly that text |
#custom-id |
the headline whose CUSTOM_ID property matches |
(label) |
a coderef (ref:label) in a source/example block |
some words |
a <<some words>> target, a #+NAME:, a headline |
Searches ignore case and extra whitespace, and headline searches ignore the
TODO keyword, the priority, COMMENT, tags and statistics cookies.
5.1. Headline links
- Exact title: 5.2
- Different case and spacing: 5.2
- With a description: jump to the practice area
- The heading has a TODO keyword, priority, cookie and tags, which are ignored: still the same heading
Try: press <CR> on each of the links above, then <C-o> to return.
Expect: every one lands on the line
"Target practice" (the one with TODO, [#B], a [0/0]
cookie and the tag :practice:).
5.2. TODO Target practice [0/0]  practice
This heading is the destination of the links in the previous section.
5.3. Custom IDs
A CUSTOM_ID property gives a heading a stable name that you choose. Links
to it start with #. The headings "Anatomy of a link" and "Following
links" above have the custom IDs anatomy and following.
- [BROKEN LINK: no-such-id]
Try: follow each link.
Expect: the first two land on their headings; the last one shows the message "No match for custom ID: no-such-id" and the cursor stays here.
5.4. Dedicated targets <<...>>
A dedicated target is <<text>> anywhere in the text; a link [[text]]
jumps to it. The target itself is shown in a special colour.
Some filler text so the jump is visible. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.
This line is the , where the two links above land.
Try: press <CR> on "parking spot" in the first item.
Expect: the cursor is on the <<parking spot>> target in the last
paragraph.
5.5. Named elements #+NAME:
A link can also point to any element with a #+NAME: line: a table, a
block, a list, a paragraph.
- Jump to the table named No description for this link.
- Jump to the block named the hello block.
| Item | Price |
|---|---|
| Coffee | 2.50 |
| Tea | 1.80 |
echo "hello"
Try: press <CR> on "prices" in the first item.
Expect: the cursor lands on the #+NAME: prices line above the table.
5.6. Coderefs (label)
Inside a source or example block, a line can end with (ref:label). The
link [[(label)]] jumps to that line.
local total = 0
for i = 1, 10 do (loop)
total = total + i (add)
end
print(total)
In line loop we start the loop, and line the addition adds each number.
Try: press <CR> on (loop) in the sentence above.
Expect: the cursor jumps to the line for i = 1, 10 do (ref:loop) in
the block.
5.7. Links whose target is missing
When a [[words]] link finds no target, name or headline, org.nvim asks
"No match - create this as a new heading?" (the default of
links.search_must_match_exact_headline, "query-to-create"). Answer y
and the heading is added at the end of this file; answer n and you get
"No match for fuzzy expression: …".
- [BROKEN LINK: A heading that does not exist yet]
Try: press <CR> on the link above and answer n.
Expect: the message "No match for fuzzy expression: A heading that does
not exist yet". Do it again and answer y: a new heading
"A heading that does not exist yet" appears at the very end of the file
and the cursor is on it. Press u to remove it again.
6. Radio targets
A radio target has three angle brackets: <<<radio word>>>. Every other
occurrence of those words in the file becomes a link to the target
automatically, with no brackets at all (and also in export). Case does not
matter, but the words must stand alone.
This paragraph defines the radio target Org mode. From now on, any "org mode" in this file is a link to it.
- Org mode is a plain-text format.
- Many people use ORG MODE for notes.
- The words may even be split over lines: Emacs Org mode is where the format comes from.
- "Org modes" is not a match, because "modes" is a different word.
Try: put the cursor on "Org mode" in the first item and press <CR>.
Expect: the cursor jumps to <<<Org mode>>> in the paragraph above.
Try: type a new line below with the text "I like org mode.". It is not
highlighted as a link yet. Put the cursor on <<<Org mode>>> and press
<C-c><C-c>: the radio links are refreshed and the new text is a link too.
7. File links
file: links open a file. Relative paths are relative to the directory of
this file (examples/).
- The index of all example files
- Footnotes (the next file in the series)
- The broad tutorial
Try: press <CR> on "the bundled init file".
Expect: a second window opens with examples/minimal_init.lua. Close it
with :q.
7.1. Search options ::
Add ::something after the file name to jump somewhere inside the file:
| Option | Jumps to |
|---|---|
::42 |
line 42 |
::*Heading |
the headline "Heading" (Org files) |
::#custom-id |
the headline with that CUSTOM_ID |
::(label) |
a coderef |
::/regexp/ |
every match: a sparse tree in Org files, a location |
| list elsewhere | |
::some text |
a target, name or headline "some text"; in other |
| files the first line containing the text |
- [BROKEN LINK: 18]
- [BROKEN LINK: agenda_files]
Try: follow "line 18 of the init file".
Expect: minimal_init.lua opens in another window with the cursor on
line 18, vim.opt.termguicolors = true.
Try: follow "every description line".
Expect: the init file opens and a location list lists the lines containing =description = = (one per capture template and custom agenda command), and the message "8 matches for description = ".
Try: follow "every "radio" in this file".
Expect: this buffer turns into a sparse tree: only the headings with a
match are unfolded and the matches are highlighted. <S-Tab> brings back
the normal view.
7.2. Wildcards, system apps and Neovim
- A file name with a wildcard (
*,?,{) lists the matching files: all Org files in examples/. In the list,<CR>opens the file on the line andqcloses it. file+sys:pathalways uses the system application andfile+emacs:pathalways opens the file in Neovim. Emacs considers both deprecated (:Org lintsays so): prefer a count on an ordinaryfile:link,4<CR>for Neovim and16<CR>for the system application.- Files Neovim cannot show (images, PDF, office documents, HTML) open with
the system application: a screenshot.
links.file_appschanges that per extension.
Try: press <CR> on "all Org files in examples/".
Expect: a scratch buffer that starts with the directory name and
"wildcard *.org", then lists 00-index.org, 01-outline.org …
tutorial.org, one per line. Put the cursor on 14-footnotes.org and
press <CR> to open it; q closes the list.
8. Web and other external links
| Type | Example | Opens with |
|---|---|---|
http https |
https://orgmode.org |
browser |
mailto |
mailto:someone@example.com |
mail client |
doi |
doi:10.1000/182 |
browser, via doi.org |
help |
help:org-links |
Vim's :help |
man |
man:printf(3) |
:Man |
info |
info:emacs#Top |
the info program |
shell |
shell:ls -la |
a shell (asks first) |
elisp |
elisp:(+ 1 2) |
a separate Emacs (asks) |
attachment |
attachment:notes.txt |
the entry's attachment dir |
- [BROKEN LINK: man:ls]
- [BROKEN LINK: man:ls::-l]
Try: press <CR> on ":h org-links".
Expect: a help window opens at the section "16. LINKS, IDS AND
ATTACHMENTS". :q closes it.
8.1. Shell and Emacs Lisp links
shell: links run a command in the directory of this file. For safety,
org.nvim asks first (links.confirm_shell). The output goes to a new
*Org Shell Output* buffer, or is echoed when it is one line.
Try: press <CR> on "say hello" and answer y.
Expect: the question Execute echo "hello from a link" in shell? and,
after y, the message hello from a link.
Try: press <CR> on "list the example files" and answer y.
Expect: a window *Org Shell Output* with one file name per line
(00-index.org, 01-outline.org, …).
elisp: links evaluate Emacs Lisp in a separate emacs --batch process
(you need Emacs installed; it cannot touch your Neovim buffers). They ask
first too (links.confirm_elisp):
Expect: the question Execute (+ 1 2 3) as Elisp? and, after y, the
message (+ 1 2 3) => 6.
9. Link abbreviations #+LINK:
The #+LINK: lines at the top of this file define short prefixes:
#+LINK: gh https://github.com/%s #+LINK: ddg https://duckduckgo.com/?q=%h #+LINK: wiki https://en.wikipedia.org/wiki/ #+LINK: ex file:./%s
%sis replaced by the text after the colon (the "tag").%his the same, but URL-encoded (spaces become%20).- Without
%sor%h, the tag is appended at the end.
Abbreviations for every file go in links.abbreviations in your config:
{ gh = "https://github.com/%s" }, or a Lua function that receives the tag.
Try: press <CR> on "footnotes, via "ex:"".
Expect: 14-footnotes.org opens in another window on its
"How to use this file" heading.
Try: press <prefix>lt and look at the raw links above; then add your
own #+LINK: line at the top of the file, press <C-c><C-c> on it so the
buffer re-reads the settings, and use it in a link below.
10. Storing and inserting links
The usual way to make a link is in two steps: store a link to where you
are (<prefix>ls), then insert it where you want it (<prefix>li).
10.1. <prefix>ls: store a link
<prefix>ls works in any buffer, not only Org files. What it stores
depends on where you are:
| Where | Stored link |
|---|---|
on a <<target>> |
file:13-links.org::target |
on a #+NAME: element |
file:...::name |
on a headline with CUSTOM_ID |
file:...::#id (and ::*Heading) |
| on any headline | file:...::*Heading |
| in a Visual selection | the selection as search text |
| in a non-Org file | file:path::current line text |
in a :help buffer |
help:tag |
| in the agenda | a link to the item's entry |
With links.use_id = true headings are stored as id: links instead (and
get an ID property).
10.2. <prefix>li: insert a link
<prefix>li asks for the link. The prompt completes stored links, link
types (https:, file:, id:, gh: …) and file names. An empty answer
inserts the last stored link. Then it asks for a description, pre-filled
with the stored one: edit it, or clear it with <C-u> for none.
- On an existing link,
<prefix>liedits it: the prompt starts with its target, then its description. - In Visual mode, the selected text becomes the description.
- Stored links are removed from the list once inserted
(
links.keep_stored_after_insertion). - Links to places in the same file are shortened:
file:13-links.org::*Xis inserted as[[*X]].
10.3. Exercises
10.3.1. Store and insert a heading link
Try:
- Put the cursor on the heading "Target practice" (in "Internal links")
and press
<prefix>ls. - Come back here with
<C-o>, go to the empty line below the next comment, and press<prefix>li. - The prompt shows
Insert link (default file:...::*Target practice); press<CR>to take the default. The description prompt is pre-filled with "Target practice": press<C-u>to clear it, typepracticeand press<CR>.
Expect: the message Stored: Target practice after step 1, and after
step 3 the new text [[*Target practice][practice]], shown as "practice".
Press <CR> on it to check it works.
10.3.2. Store and insert a link to a line of another file
Try:
- Open the init file, put the cursor on the
line
org_directory = scratch,and press<prefix>ls. - Come back (
<C-o>or:b 13-links.org) and press<prefix>lLon the empty line below.
Expect: after step 1 the message
Stored: file:~/.../minimal_init.lua::org_directory = scratch,
and after step 2 the line
[[file:minimal_init.lua::org_directory = scratch,][<no description>]]
followed by a new line. <prefix>lL inserts the last stored link at once,
without prompts; the path became relative to this file, and a link
without a description gets <no description>, like in Emacs.
10.3.3. Store several, insert them all
Try: store links to the three headings "Anatomy of a link", "Following
links" and "Radio targets" with <prefix>ls on each. Then press
<prefix>lA on the empty line below.
Expect: three list items, the most recently stored first:
- [[*Radio targets][Radio targets]] - [[#following][Following links]] - [[#anatomy][Anatomy of a link]]
Headings with a CUSTOM_ID are linked by their custom ID. 4<prefix>lA
keeps the links in the stored list instead of forgetting them.
10.3.4. Edit an existing link
Try: on the link above press <prefix>li, change the target to
https://example.org and the description to another site.
Expect: the item now reads - [[https://example.org][another site]].
10.3.5. Turn selected text into a link
Try: select the words "Neovim homepage" below in Visual mode (v and
move), press <prefix>li, type https://neovim.io and press <CR>
twice (the description prompt is pre-filled with the selection).
Expect: the words become [[https://neovim.io][Neovim homepage]].
The Neovim homepage is a good place to start.
10.3.6. Store a link in a help buffer
Try: run :help org-footnotes, press <prefix>ls in the help window,
close it, and press <prefix>lL on the empty line below.
Expect: the message "Stored: help:org-footnotes", then the line
[[help:org-footnotes][<no description>]].
10.4. Completing links while typing
In Insert mode, after [[ press <C-x><C-o> (or let blink.cmp / nvim-cmp
do it): link types and stored links are offered; after [[* the headings
of this file; after [[# the custom IDs.
Try: on the empty line below, type [[*Rad in Insert mode and press
<C-x><C-o>.
Expect: "Radio targets" is offered. Accept it and close the link with
]].
11. IDs
An ID property is a globally unique name for an entry. Links of the form
[[id:...]] find the entry wherever it is: in this file, in another
agenda file, even after you refiled it to a different file. That makes
them the most robust links to headings.
| Key | Action |
|---|---|
<prefix>lI |
give the entry an ID (or show its ID); |
4<prefix>lI replaces it with a new one |
|
<prefix>ly |
copy the entry's ID, creating it |
<prefix>lg |
go to an entry by ID (IDs are completed) |
:Org id_update_locations |
rebuild the ID database from the agenda files |
:Org id_store_link |
store an id: link even without use_id |
The ID database (id.locations_file) remembers which file holds which ID;
with the bundled init file it lives in a scratch directory. When an ID is
not where the database says, org.nvim scans the agenda files for it.
11.1. An entry with an ID
This entry has an ID. Links to it:
- [BROKEN LINK: 7f3c9a52-1d2e-4c6b-9a0f-13a1b2c3d4e5::*A child without an ID]
- [BROKEN LINK: 7f3c9a52-1d2e-4c6b-9a0f-13a1b2c3d4e5::hidden spot]
This line holds the the third link goes to.
Try: follow the three links (from here, or after moving this entry
around with <M-j>: IDs don't care where the entry is).
Expect: the first lands on the heading "An entry with an ID", the second on its child "A child without an ID", the third on the line "This line holds the …".
11.1.1. A child without an ID
Found through the ID of its parent plus ::*A child without an ID.
11.2. An ID in another file
The footnotes example file has an entry with the ID
0f5e2d1c-7b3a-4e8f-9c6d-14f00e1d2c3b:
- [BROKEN LINK: 0f5e2d1c-7b3a-4e8f-9c6d-14f00e1d2c3b]
Try: follow the link.
Expect: 14-footnotes.org opens in another window, on the heading
"Named footnotes" (org.nvim scanned the agenda files to find the ID and
recorded where it is).
11.3. Create, copy and go to IDs
11.3.1. Give me an ID
Try: on the heading above, press <prefix>lI.
Expect: a :PROPERTIES: drawer appears under the heading with a line
like :ID: 3c1b9a... (a new UUID), and the ID is echoed. Press <prefix>lI
again: the same ID is shown, nothing changes. 4<prefix>lI replaces it.
Try: press <prefix>ly on the same heading, then p on an empty line.
Expect: the message "Copied ID …" and p pastes the ID (it went to
the clipboard and the unnamed register).
Try: run :Org id_update_locations (it scans the agenda files, here
examples/*.org, and reports how many IDs it found). Then press
<prefix>lg, type 7f3c and complete with <Tab>; press <CR>.
Expect: the cursor jumps to the heading "An entry with an ID". (<prefix>lg
completes the IDs of the database, which starts empty with the bundled
init file: that is why the update comes first.)
11.3.2. Store id: links automatically
Try: :lua require("org.config").opts.links.use_id = true, then press
<prefix>ls on the heading "Give me an ID" and <prefix>lL on the empty
line below. Set the option back to false afterwards.
Expect: an [[id:...][Give me an ID]] link using the ID created before.
12. Attachments
An entry can have files attached: they live in a directory that belongs
to the entry, and [[attachment:name]] links refer to them by name. The
directory is:
- the entry's
DIRproperty, when it has one (relative to this file), or attach.dir(defaultdata/) plus a folder made from the entry'sID: the ID7f3c9a52-...givesdata/7f/3c9a52-....
When an entry has neither, attaching gives it an ID. Attaching also adds
the ATTACH tag and stores an attachment: link (<prefix>lL inserts it).
12.1. The attachment menu <prefix>A
<prefix>A (C-c C-a) on a headline opens this menu:
| Key | Action |
|---|---|
a |
attach a file (attach.method: cp by default) |
c m l y |
attach by copy / move / hard link / symbolic link |
u |
download a URL into the directory (curl) |
b |
attach the contents of another buffer |
n |
create a new file in the directory and edit it |
z |
synchronise the ATTACH tag with the directory |
o / O |
open an attachment (system app / Neovim) |
f / F |
open the directory (system app / Neovim) |
d / D |
delete one attachment / all of them |
s / S |
set / remove the DIR property |
12.2. An entry whose DIR is an existing folder
This entry's attachment directory is docs/media of the repository, so
these links work without attaching anything first:
Try: press <CR> on "the media README".
Expect: docs/media/README.md opens in another window.
Try: on this entry's headline, press <prefix>A then F.
Expect: the docs/media directory opens in Neovim (netrw or your file
explorer).
12.3. Attach something yourself
12.3.1. Notes for the trip
Try:
- On the heading "Notes for the trip" press
<prefix>A, thenn, and typepacking.txt. - A split opens on the new file; type a few words and
:wq.
Expect: the heading now has an ID (in a new property drawer) and the
tag :ATTACH:, and the file examples/data/xx/yyyy.../packing.txt exists
(xx/yyyy... is the ID split after two characters).
Try: on the heading press <prefix>A then O and pick packing.txt.
Expect: the file opens in Neovim.
Try: type [[attachment:packing.txt]] in the body of "Notes for the
trip" (below the property drawer) and press <CR> on it.
Expect: packing.txt opens again.
Try: <prefix>A then d, pick packing.txt; then <prefix>A then z.
Expect: the file is deleted (with a single attachment there is nothing
to pick). z then asks "Attachment directory is empty. Delete?"; after
y the ATTACH tag is gone from the heading (the ID stays).
Finally clean up with rm -rf examples/data.
13. Custom link types
You can add your own link types in the config, under links.types
(Emacs' org-link-set-parameters). A type is a follow function, or a table
with follow, complete, store, export, face,
insert_description and preview:
require("org").setup({
links = {
types = {
-- [[issue:123]] opens the GitHub issue 123 of org.nvim
issue = function(path)
vim.ui.open("https://github.com/xheisenbugx/org.nvim/issues/" .. path)
end,
},
},
})
After that, [[issue:1]] follows with <CR>, is completed after [[,
and exports as a link. Simpler cases are better served by a #+LINK:
abbreviation (see Link abbreviations).
Other hooks: links.make_description(link, desc) gives inserted links a
default description, links.search_functions handle ::search options
first, and links.translation_function(type, path) rewrites links before
they are followed.
14. What is not supported
help:opens Vim's:help, not Emacs' describe-function.- Links to Emacs applications (
gnus:,rmail:,bbdb:,irc:,eww:,w3m:,calendar:…) cannot be followed or stored. elisp:links run in a separate Emacs process, never inside Neovim, so commands acting on the editor fail.- Wildcard
file:links list the matches in a scratch buffer instead of Emacs' Dired. ::/regexp/searches translate Emacs regexps to Vim regexps; exotic Emacs syntax is approximated.
See :h org-differences for the full list.
15. Further reading
:h org-links- syntax, every link type, the keys
:h org-id- IDs and the ID database
:h org-attachand:h org-attach-git- attachments
:h org-completion- link completion
:h org-images- previewing image links, see also 21-images-latex.org
:h org-differences- what differs from Emacs