File tree 5 files changed +30
-1
lines changed
5 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -1637,6 +1637,11 @@ Abort changes made to temporary buffer created from the content of a `SRC` block
1637
1637
_ mapped to_ : ` <Leader>ow ` <br />
1638
1638
Apply changes from the special buffer to the source Org buffer<br />
1639
1639
1640
+ #### ** org_edit_src_save_exit**
1641
+
1642
+ _ mapped to_ : ` <Leader>' ` <br />
1643
+ Apply changes from the special buffer to the source Org buffer and close the edit special window<br />
1644
+
1640
1645
#### ** org_edit_src_show_help**
1641
1646
1642
1647
_ mapped to_ : ` g? ` <br />
Original file line number Diff line number Diff line change 106
106
--- @field org_toggle_checkbox ? string Default : ' <C-Space>'
107
107
--- @field org_toggle_heading ? string Default : ' <prefix>*'
108
108
--- @field org_open_at_point ? string Default : ' <prefix>o'
109
- --- @field org_edit_special ? string Default : [[ <prefix>']]
109
+ --- @field org_edit_special ? string Default : " <prefix>'"
110
110
--- @field org_add_note ? string Default : ' <prefix>na'
111
111
--- @field org_cycle ? string Default : ' <TAB>'
112
112
--- @field org_global_cycle ? string Default : ' <S-TAB>'
158
158
--- @class OrgMappingsEditSrc
159
159
--- @field org_edit_src_abort ? string Default : ' <prefix>k'
160
160
--- @field org_edit_src_save ? string Default : ' <prefix>w'
161
+ --- @field org_edit_src_save_exit ? string Default : " <prefix>'"
161
162
--- @field org_edit_src_show_help ? string Default : ' g?'
162
163
---
163
164
--- @class OrgEmacsConfig
Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ local DefaultConfig = {
188
188
edit_src = {
189
189
org_edit_src_abort = ' <prefix>k' ,
190
190
org_edit_src_save = ' <prefix>w' ,
191
+ org_edit_src_save_exit = [[ <prefix>']] ,
191
192
org_edit_src_show_help = ' g?' ,
192
193
},
193
194
text_objects = {
Original file line number Diff line number Diff line change @@ -373,6 +373,15 @@ return {
373
373
[[ <Cmd>lua require('orgmode.objects.edit_special'):new():write()<CR>]] ,
374
374
{ opts = { desc = ' org save' , help_desc = ' Apply changes from the special buffer to the source Org buffer' } }
375
375
),
376
+ org_edit_src_save_exit = m .custom (
377
+ [[ <Cmd>lua require('orgmode.objects.edit_special'):new():write_end_exit()<CR>]] ,
378
+ {
379
+ opts = {
380
+ desc = ' org save and exit' ,
381
+ help_desc = ' Apply changes from the special buffer to the source Org buffer and exit' ,
382
+ },
383
+ }
384
+ ),
376
385
},
377
386
text_objects = {
378
387
inner_heading = m .text_object (' inner_heading' , { help_desc = ' Select inner headline' }),
Original file line number Diff line number Diff line change @@ -119,6 +119,19 @@ function EditSpecial:write()
119
119
:write (ctx )
120
120
end
121
121
122
+ function EditSpecial :write_end_exit ()
123
+ local ctx = self :get_context (vim .api .nvim_get_current_buf ())
124
+
125
+ self .block_types [ctx .block_type ]
126
+ :new ({
127
+ org_bufnr = ctx .org_bufnr ,
128
+ org_pos = ctx .org_pos ,
129
+ file = ctx .file ,
130
+ })
131
+ :write (ctx )
132
+ vim .cmd ([[ q!]] )
133
+ end
134
+
122
135
function EditSpecial :done ()
123
136
local wiped_bufnr = vim .api .nvim_get_current_buf ()
124
137
local ctx = self :get_context (wiped_bufnr )
You can’t perform that action at this time.
0 commit comments