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
1229
+
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
1230
+
symlink itself. The default is to treat the symlink transparently as
1231
+
a directory.
1232
+
1233
+
*** =org_attach_visit_command=
1234
+
:PROPERTIES:
1235
+
:CUSTOM_ID: org_attach_visit_command
1236
+
:END:
1237
+
- Type: =string|fun(path: string)=
1238
+
- Default: ='edit'=
1239
+
1240
+
Command or function used to open a directory. The default opens NetRW if it
1241
+
is available.
1242
+
1243
+
*** =org_attach_use_inheritance=
1244
+
:PROPERTIES:
1245
+
:CUSTOM_ID: org_attach_use_inheritance
1246
+
:END:
1247
+
- Type: ='always'|'selective'|'never'=
1248
+
- Default: ='selective'=
1249
+
1250
+
Attachment inheritance for the outline.
1251
+
1252
+
Enabling inheritance implies two things:
1253
+
1. Attachment links will look through all parent headlines until they find
1254
+
the linked attachment.
1255
+
2. Running =attach= inside a node without attachments will operate on the
1256
+
first parent headline that has an attachment.
1257
+
1258
+
Possible values are:
1259
+
1260
+
- =always= - inherit attachments
1261
+
- =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
1295
+
from an =ID= property. The functions are called with a single =id= argument
1296
+
until the return value is an existing folder. The ID format passed to the
1297
+
functions is usually defined by [[#org_id_method][org_id_method]].
1298
+
1299
+
If no folder has been created yet for the given ID, then the first truthy
1300
+
value defines the path of the folder to be created.
1301
+
1302
+
The default functions avoid putting all attachment directories directly
1303
+
inside [[#org_attach_id_dir][org_attach_id_dir]]. Some file systems have performance issues in
1304
+
such scenarios.
1305
+
1306
+
Be careful when changing this setting. If you remove a function, previously
1307
+
created attachment folders may be no longer mapped correctly and Org may be
1308
+
unable to detect them.
1309
+
1310
+
*** =org_attach_sync_delete_empty_dir=
1311
+
:PROPERTIES:
1312
+
:CUSTOM_ID: org_attach_sync_delete_empty_dir
1313
+
:END:
1314
+
- Type: ='always'|'ask'|'never'=
1315
+
- Default: ='ask'=
1316
+
1317
+
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]].
1318
+
1319
+
- =never= - never delete empty directories
1320
+
- =ask= - ask the user whether to delete
1321
+
- =always= - delete empty directories without asking
1322
+
1157
1323
** Mappings
1158
1324
:PROPERTIES:
1159
1325
:CUSTOM_ID: mappings
@@ -2064,6 +2230,13 @@ See [[#clocking][Clocking]] for more details.
2064
2230
- Mapped to: =<leader>obt=
2065
2231
Tangle current file. See [[#extract-source-code-tangle][Extract source code (tangle)]] for more details.
2066
2232
2233
+
**** =org_attach=
2234
+
:PROPERTIES:
2235
+
:CUSTOM_ID: org_attach
2236
+
:END:
2237
+
- Mapped to: =<Leader>o<C-A>=
2238
+
Open the attach dispatcher. See [[#attachments][Attachments]] for more details.
2239
+
2067
2240
**** =org_show_help=
2068
2241
:PROPERTIES:
2069
2242
:CUSTOM_ID: org_show_help
@@ -2748,6 +2921,43 @@ Running [[#org_babel_tangle][org_babel_tangle]] will create file =~/org/my_tangl
2748
2921
=print('Headline 1')=
2749
2922
=#+end_src=
2750
2923
2924
+
*** Attachments
2925
+
:PROPERTIES:
2926
+
:CUSTOM_ID: attachments
2927
+
:END:
2928
+
2929
+
There is almost complete support for file attachments (Orgmode link:
2930
+
[[https://orgmode.org/manual/Attachments.html][Attachments]]). You can use [[#org_attach][org_attach]] to open the dispatcher and attach
2931
+
files to an "attachment node" (either a headline or an entire org
2932
+
file).
2933
+
2934
+
Attaching a file puts it in a directory associated with the attachment node.
2935
+
Based on [[#org_attach_preferred_new_method][org_attach_preferred_new_method]], this either uses the =ID= or
2936
+
the =DIR= property. See also [[#org_attach_id_dir][org_attach_id_dir]],
2937
+
[[#org_attach_dir_relative][org_attach_dir_relative]], [[#org_attach_id_to_path_function_list][org_attach_id_to_path_function_list]] and
2938
+
[[#org_attach_use_inheritance][org_attach_use_inheritance]] on how to further customize the attachments
2939
+
directory.
2940
+
2941
+
Attachment links are supported. A link like =[[attachment:file.txt]]=
2942
+
looks up =file.txt= in the current node's attachments directory and opens
2943
+
it. Attaching a file stores a link to the attachment. See
2944
+
[[#org_attach_store_link_p][org_attach_store_link_p]] on how to configure this behavior.
2945
+
2946
+
You can also attach files from a different buffer. The following
2947
+
mapping attaches the path under the cursor to the current headline of the
2948
+
most recently open org file:
2949
+
2950
+
#+begin_src lua
2951
+
vim.keymap.set('n', '<Leader>o+', function()
2952
+
local file = vim.fn.expand('<cfile>')
2953
+
local org = require('orgmode')
2954
+
org.attach:attach_to_other_buffer(file)
2955
+
end)
2956
+
#+end_src
2957
+
2958
+
The only missing feature is expansion of attachment links before exporting
0 commit comments