You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If =true=, whenever the attachments directory itself is a symlink, and it
1227
+
is copied due to the [[https://orgmode.org/manual/Attachment-defaults-and-dispatcher.html*index-C_002dc-C_002da-s][set_directory]] or [[https://orgmode.org/manual/Attachment-defaults-and-dispatcher.html*index-C_002dc-C_002da-S][unset_directory]] action, copy the
1228
+
symlink itself. The default is to treat the symlink transparently as
1229
+
a directory.
1230
+
1231
+
*** org_attach_visit_command
1232
+
:PROPERTIES:
1233
+
:CUSTOM_ID: org_attach_visit_command
1234
+
:END:
1235
+
- Type: =string|fun(path: string)=
1236
+
- Default: ='edit'=
1237
+
1238
+
Command or function used to open a directory. The default opens NetRW if it
1239
+
is available.
1240
+
1241
+
*** org_attach_use_inheritance
1242
+
:PROPERTIES:
1243
+
:CUSTOM_ID: org_attach_use_inheritance
1244
+
:END:
1245
+
- Type: ='always'|'selective'|'never'=
1246
+
- Default: ='selective'=
1247
+
1248
+
Attachment inheritance for the outline.
1249
+
1250
+
Enabling inheritance implies two things:
1251
+
1. Attachment links will look through all parent headlines until they find
1252
+
the linked attachment.
1253
+
2. Running =attach= inside a node without attachments will operate on the
1254
+
first parent headline that has an attachment.
1255
+
1256
+
Possible values are:
1257
+
1258
+
- =always= - inherit attachments
1259
+
- =selective= - respect [[#org_use_property_inheritance][org_use_property_inheritance]] for the properties =DIR= and =ID=
List of functions that are tried sequentially to derive an attachment path
1293
+
from an =ID= property. The functions are called with a single =id= argument
1294
+
until the return value is an existing folder. The ID format passed to the
1295
+
functions is usually defined by [[#org_id_method][org_id_method]].
1296
+
1297
+
If no folder has been created yet for the given ID, then the first truthy
1298
+
value defines the path of the folder to be created.
1299
+
1300
+
The default functions avoid putting all attachment directories directly
1301
+
inside [[#org_attach_id_dir][org_attach_id_dir]]. Some file systems have performance issues in
1302
+
such scenarios.
1303
+
1304
+
Be careful when changing this setting. If you remove a function, previously
1305
+
created attachment folders may be no longer mapped correctly and Org may be
1306
+
unable to detect them.
1307
+
1308
+
*** org_attach_sync_delete_empty_dir
1309
+
:PROPERTIES:
1310
+
:CUSTOM_ID: org_attach_sync_delete_empty_dir
1311
+
:END:
1312
+
- Type: ='always'|'ask'|'never'=
1313
+
- Default: ='ask'=
1314
+
1315
+
Determines whether to delete empty directories during [[https://orgmode.org/manual/Attachment-defaults-and-dispatcher.html*index-C_002dc-C_002da-z][org_attach_sync]].
1316
+
1317
+
- =never= - never delete empty directories
1318
+
- =ask= - ask the user whether to delete
1319
+
- =always= - delete empty directories without asking
1320
+
1155
1321
** Mappings
1156
1322
:PROPERTIES:
1157
1323
:CUSTOM_ID: mappings
@@ -2062,6 +2228,13 @@ See [[#clocking][Clocking]] for more details.
2062
2228
- Mapped to: =<leader>obt=
2063
2229
Tangle current file. See [[#extract-source-code-tangle][Extract source code (tangle)]] for more details.
2064
2230
2231
+
**** org_attach
2232
+
:PROPERTIES:
2233
+
:CUSTOM_ID: org_attach
2234
+
:END:
2235
+
- Mapped to: =<Leader>o<C-A>=
2236
+
Open the attach dispatcher. See [[#attachments][Attachments]] for more details.
2237
+
2065
2238
**** org_show_help
2066
2239
:PROPERTIES:
2067
2240
:CUSTOM_ID: org_show_help
@@ -2820,6 +2993,43 @@ Running [[#org_babel_tangle][org_babel_tangle]] will create file =~/org/my_tangl
2820
2993
=print('Headline 1')=
2821
2994
=#+end_src=
2822
2995
2996
+
*** Attachments
2997
+
:PROPERTIES:
2998
+
:CUSTOM_ID: attachments
2999
+
:END:
3000
+
3001
+
There is almost complete support for file attachments (Orgmode link:
3002
+
[[https://orgmode.org/manual/Attachments.html][Attachments]]). You can use [[#org_attach][org_attach]] to open the dispatcher and attach
3003
+
files to an "attachment node" (either a headline or an entire org
3004
+
file).
3005
+
3006
+
Attaching a file puts it in a directory associated with the attachment node.
3007
+
Based on [[#org_attach_preferred_new_method][org_attach_preferred_new_method]], this either uses the =ID= or
3008
+
the =DIR= property. See also [[#org_attach_id_dir][org_attach_id_dir]],
3009
+
[[#org_attach_dir_relative][org_attach_dir_relative]], [[#org_attach_id_to_path_function_list][org_attach_id_to_path_function_list]] and
3010
+
[[#org_attach_use_inheritance][org_attach_use_inheritance]] on how to further customize the attachments
3011
+
directory.
3012
+
3013
+
Attachment links are supported. A link like =[[attachment:file.txt]]=
3014
+
looks up =file.txt= in the current node's attachments directory and opens
3015
+
it. Attaching a file stores a link to the attachment. See
3016
+
[[#org_attach_store_link_p][org_attach_store_link_p]] on how to configure this behavior.
3017
+
3018
+
You can also attach files from a different buffer. The following
3019
+
mapping attaches the path under the cursor to the current headline of the
3020
+
most recently open org file:
3021
+
3022
+
#+begin_src lua
3023
+
vim.keymap.set('n', '<Leader>o+', function()
3024
+
local file = vim.fn.expand('<cfile>')
3025
+
local org = require('orgmode')
3026
+
org.attach:attach_to_other_buffer(file)
3027
+
end)
3028
+
#+end_src
3029
+
3030
+
The only missing feature is expansion of attachment links before exporting
0 commit comments