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
1187
+
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
1188
+
symlink itself. The default is to treat the symlink transparently as
1189
+
a directory.
1190
+
1191
+
*** org_attach_visit_command
1192
+
:PROPERTIES:
1193
+
:CUSTOM_ID: org_attach_visit_command
1194
+
:END:
1195
+
- Type: =string|fun(path: string)=
1196
+
- Default: ='edit'=
1197
+
1198
+
Command or function used to open a directory. The default opens NetRW if it
1199
+
is available.
1200
+
1201
+
*** org_attach_use_inheritance
1202
+
:PROPERTIES:
1203
+
:CUSTOM_ID: org_attach_use_inheritance
1204
+
:END:
1205
+
- Type: ='always'|'selective'|'never'=
1206
+
- Default: ='selective'=
1207
+
1208
+
Attachment inheritance for the outline.
1209
+
1210
+
Enabling inheritance implies two things:
1211
+
1. Attachment links will look through all parent headlines until they find
1212
+
the linked attachment.
1213
+
2. Running =attach= inside a node without attachments will operate on the
1214
+
first parent headline that has an attachment.
1215
+
1216
+
Possible values are:
1217
+
1218
+
- =always= - inherit attachments
1219
+
- =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
1253
+
from an =ID= property. The functions are called with a single =id= argument
1254
+
until the return value is an existing folder. The ID format passed to the
1255
+
functions is usually defined by [[#org_id_method][org_id_method]].
1256
+
1257
+
If no folder has been created yet for the given ID, then the first truthy
1258
+
value defines the path of the folder to be created.
1259
+
1260
+
The default functions avoid putting all attachment directories directly
1261
+
inside [[#org_attach_id_dir][org_attach_id_dir]]. Some file systems have performance issues in
1262
+
such scenarios.
1263
+
1264
+
Be careful when changing this setting. If you remove a function, previously
1265
+
created attachment folders may be no longer mapped correctly and Org may be
1266
+
unable to detect them.
1267
+
1268
+
*** org_attach_sync_delete_empty_dir
1269
+
:PROPERTIES:
1270
+
:CUSTOM_ID: org_attach_sync_delete_empty_dir
1271
+
:END:
1272
+
- Type: ='always'|'ask'|'never'=
1273
+
- Default: ='ask'=
1274
+
1275
+
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]].
1276
+
1277
+
- =never= - never delete empty directories
1278
+
- =ask= - ask the user whether to delete
1279
+
- =always= - delete empty directories without asking
1280
+
1125
1281
** Mappings
1126
1282
:PROPERTIES:
1127
1283
:CUSTOM_ID: mappings
@@ -2032,6 +2188,13 @@ See [[#clocking][Clocking]] for more details.
2032
2188
- Mapped to: =<leader>obt=
2033
2189
Tangle current file. See [[#extract-source-code-tangle][Extract source code (tangle)]] for more details.
2034
2190
2191
+
**** org_attach
2192
+
:PROPERTIES:
2193
+
:CUSTOM_ID: org_attach
2194
+
:END:
2195
+
- Mapped to: =<Leader>o<C-A>=
2196
+
Open the attach dispatcher. See [[#attachments][Attachments]] for more details.
2197
+
2035
2198
**** org_show_help
2036
2199
:PROPERTIES:
2037
2200
:CUSTOM_ID: org_show_help
@@ -2790,6 +2953,42 @@ Running [[#org_babel_tangle][org_babel_tangle]] will create file =~/org/my_tangl
2790
2953
=print('Headline 1')=
2791
2954
=#+end_src=
2792
2955
2956
+
*** Attachments
2957
+
:PROPERTIES:
2958
+
:CUSTOM_ID: attachments
2959
+
:END:
2960
+
2961
+
There is almost complete support for file attachments (Orgmode link:
2962
+
[[https://orgmode.org/manual/Attachments.html][Attachments]]). You can use [[#org_attach][org_attach]] to open the dispatcher and attach
2963
+
files to an "attachment node" (either a headline or an entire org
2964
+
file).
2965
+
2966
+
Attaching a file puts it in a directory associated with the attachment node.
2967
+
Based on [[#org_attach_preferred_new_method][org_attach_preferred_new_method]], this either uses the =ID= or
2968
+
the =DIR= property. See also [[#org_attach_id_dir][org_attach_id_dir]],
2969
+
[[#org_attach_id_to_path_function_list][org_attach_id_to_path_function_list]] and [[#org_attach_use_inheritance][org_attach_use_inheritance]] on how
2970
+
to further customize the attachments directory.
2971
+
2972
+
Attachment links are supported. A link like =[[attachment:file.txt]]=
2973
+
looks up =file.txt= in the current node's attachments directory and opens
2974
+
it. Attaching a file stores a link to the attachment. See
2975
+
[[#org_attach_store_link_p][org_attach_store_link_p]] on how to configure this behavior.
2976
+
2977
+
You can also attach files from a different buffer. The following
2978
+
mapping attaches the path under the cursor to the current headline of the
2979
+
most recently open org file:
2980
+
2981
+
#+begin_src lua
2982
+
vim.keymap.set('n', '<Leader>o+', function()
2983
+
local file = vim.fn.expand('<cfile>')
2984
+
local org = require('orgmode')
2985
+
org.attach:attach_to_other_buffer(file)
2986
+
end)
2987
+
#+end_src
2988
+
2989
+
The only missing feature is expansion of attachment links before exporting
0 commit comments