11
11
_2amodule_locals_2a = (_2amodule_2a )[" aniseed/locals" ]
12
12
end
13
13
local autoload = (require (" conjure.aniseed.autoload" )).autoload
14
- local a , buffer , client , config , editor , event , extract , fs , inline , log , nvim , promise , str , text , timer , uuid = autoload (" conjure.aniseed.core" ), autoload (" conjure.buffer" ), autoload (" conjure.client" ), autoload (" conjure.config" ), autoload (" conjure.editor" ), autoload (" conjure.event" ), autoload (" conjure.extract" ), autoload (" conjure.fs" ), autoload (" conjure.inline" ), autoload (" conjure.log" ), autoload (" conjure.aniseed.nvim" ), autoload (" conjure.promise" ), autoload (" conjure.aniseed.string" ), autoload (" conjure.text" ), autoload (" conjure.timer" ), autoload (" conjure.uuid" )
14
+ local a , buffer , client , config , editor , event , extract , fs , inline , log , nu , nvim , promise , str , text , timer , uuid = autoload (" conjure.aniseed.core" ), autoload (" conjure.buffer" ), autoload (" conjure.client" ), autoload (" conjure.config" ), autoload (" conjure.editor" ), autoload (" conjure.event" ), autoload (" conjure.extract" ), autoload (" conjure.fs" ), autoload (" conjure.inline" ), autoload (" conjure.log" ), autoload ( " conjure.aniseed.nvim.util " ), autoload (" conjure.aniseed.nvim" ), autoload (" conjure.promise" ), autoload (" conjure.aniseed.string" ), autoload (" conjure.text" ), autoload (" conjure.timer" ), autoload (" conjure.uuid" )
15
15
do end (_2amodule_locals_2a )[" a" ] = a
16
16
_2amodule_locals_2a [" buffer" ] = buffer
17
17
_2amodule_locals_2a [" client" ] = client
@@ -22,6 +22,7 @@ _2amodule_locals_2a["extract"] = extract
22
22
_2amodule_locals_2a [" fs" ] = fs
23
23
_2amodule_locals_2a [" inline" ] = inline
24
24
_2amodule_locals_2a [" log" ] = log
25
+ _2amodule_locals_2a [" nu" ] = nu
25
26
_2amodule_locals_2a [" nvim" ] = nvim
26
27
_2amodule_locals_2a [" promise" ] = promise
27
28
_2amodule_locals_2a [" str" ] = str
@@ -106,19 +107,26 @@ local function client_exec_fn(action, f_name, base_opts)
106
107
display_request (opts0 )
107
108
else
108
109
end
110
+ if base_opts [" set-jump-mark?" ] then
111
+ local function _11_ ()
112
+ return nu .normal (" m'" )
113
+ end
114
+ pcall (_11_ )
115
+ else
116
+ end
109
117
return client .call (f_name , opts0 )
110
118
end
111
119
return _9_
112
120
end
113
121
_2amodule_locals_2a [" client-exec-fn" ] = client_exec_fn
114
122
local function apply_gsubs (code )
115
123
if code then
116
- local function _14_ (code0 , _11_ )
117
- local _arg_12_ = _11_
118
- local name = _arg_12_ [1 ]
119
- local _arg_13_ = _arg_12_ [2 ]
120
- local pat = _arg_13_ [1 ]
121
- local rep = _arg_13_ [2 ]
124
+ local function _16_ (code0 , _13_ )
125
+ local _arg_14_ = _13_
126
+ local name = _arg_14_ [1 ]
127
+ local _arg_15_ = _arg_14_ [2 ]
128
+ local pat = _arg_15_ [1 ]
129
+ local rep = _arg_15_ [2 ]
122
130
local ok_3f , val_or_err = pcall (string.gsub , code0 , pat , rep )
123
131
if ok_3f then
124
132
return val_or_err
@@ -127,7 +135,7 @@ local function apply_gsubs(code)
127
135
return code0
128
136
end
129
137
end
130
- return a .reduce (_14_ , code , a [" kv-pairs" ]((nvim .b [" conjure#eval#gsubs" ] or nvim .g [" conjure#eval#gsubs" ])))
138
+ return a .reduce (_16_ , code , a [" kv-pairs" ]((nvim .b [" conjure#eval#gsubs" ] or nvim .g [" conjure#eval#gsubs" ])))
131
139
else
132
140
return nil
133
141
end
@@ -137,35 +145,35 @@ local function eval_str(opts)
137
145
highlight_range (opts .range )
138
146
event .emit (" eval" , " str" )
139
147
a .update (opts , " code" , apply_gsubs )
140
- local function _17_ ()
148
+ local function _19_ ()
141
149
if opts [" passive?" ] then
142
150
return opts
143
151
else
144
152
return with_last_result_hook (opts )
145
153
end
146
154
end
147
- client_exec_fn (" eval" , " eval-str" )(_17_ ())
155
+ client_exec_fn (" eval" , " eval-str" )(_19_ ())
148
156
return nil
149
157
end
150
158
_2amodule_2a [" eval-str" ] = eval_str
151
159
local function wrap_emit (name , f )
152
- local function _18_ (...)
160
+ local function _20_ (...)
153
161
event .emit (name )
154
162
return f (... )
155
163
end
156
- return _18_
164
+ return _20_
157
165
end
158
166
_2amodule_2a [" wrap-emit" ] = wrap_emit
159
167
local doc_str = wrap_emit (" doc" , client_exec_fn (" doc" , " doc-str" ))
160
168
do end (_2amodule_locals_2a )[" doc-str" ] = doc_str
161
- local def_str = wrap_emit (" def" , client_exec_fn (" def" , " def-str" , {[" suppress-hud?" ] = true }))
169
+ local def_str = wrap_emit (" def" , client_exec_fn (" def" , " def-str" , {[" suppress-hud?" ] = true , [ " set-jump-mark? " ] = true }))
162
170
do end (_2amodule_locals_2a )[" def-str" ] = def_str
163
171
local function current_form (extra_opts )
164
172
local form = extract .form ({})
165
173
if form then
166
- local _let_19_ = form
167
- local content = _let_19_ [" content" ]
168
- local range = _let_19_ [" range" ]
174
+ local _let_21_ = form
175
+ local content = _let_21_ [" content" ]
176
+ local range = _let_21_ [" range" ]
169
177
eval_str (a .merge ({code = content , range = range , origin = " current-form" }, extra_opts ))
170
178
return form
171
179
else
@@ -178,14 +186,14 @@ local function replace_form()
178
186
local win = nvim .tabpage_get_win (0 )
179
187
local form = extract .form ({})
180
188
if form then
181
- local _let_21_ = form
182
- local content = _let_21_ [" content" ]
183
- local range = _let_21_ [" range" ]
184
- local function _22_ (result )
189
+ local _let_23_ = form
190
+ local content = _let_23_ [" content" ]
191
+ local range = _let_23_ [" range" ]
192
+ local function _24_ (result )
185
193
buffer [" replace-range" ](buf , range , result )
186
194
return editor [" go-to" ](win , a [" get-in" ](range , {" start" , 1 }), a .inc (a [" get-in" ](range , {" start" , 2 })))
187
195
end
188
- eval_str ({code = content , range = range , origin = " replace-form" , [" suppress-hud?" ] = true , [" on-result" ] = _22_ })
196
+ eval_str ({code = content , range = range , origin = " replace-form" , [" suppress-hud?" ] = true , [" on-result" ] = _24_ })
189
197
return form
190
198
else
191
199
return nil
@@ -195,9 +203,9 @@ _2amodule_2a["replace-form"] = replace_form
195
203
local function root_form ()
196
204
local form = extract .form ({[" root?" ] = true })
197
205
if form then
198
- local _let_24_ = form
199
- local content = _let_24_ [" content" ]
200
- local range = _let_24_ [" range" ]
206
+ local _let_26_ = form
207
+ local content = _let_26_ [" content" ]
208
+ local range = _let_26_ [" range" ]
201
209
return eval_str ({code = content , range = range , origin = " root-form" })
202
210
else
203
211
return nil
@@ -208,10 +216,10 @@ local function marked_form(mark)
208
216
local comment_prefix = client .get (" comment-prefix" )
209
217
local mark0 = (mark or extract [" prompt-char" ]())
210
218
local ok_3f , err = nil , nil
211
- local function _26_ ()
219
+ local function _28_ ()
212
220
return editor [" go-to-mark" ](mark0 )
213
221
end
214
- ok_3f , err = pcall (_26_ )
222
+ ok_3f , err = pcall (_28_ )
215
223
if ok_3f then
216
224
current_form ({origin = (" marked-form [" .. mark0 .. " ]" )})
217
225
editor [" go-back" ]()
@@ -225,13 +233,13 @@ local function insert_result_comment(tag, input)
225
233
local buf = nvim .win_get_buf (0 )
226
234
local comment_prefix = (config [" get-in" ]({" eval" , " comment_prefix" }) or client .get (" comment-prefix" ))
227
235
if input then
228
- local _let_28_ = input
229
- local content = _let_28_ [" content" ]
230
- local range = _let_28_ [" range" ]
231
- local function _29_ (result )
236
+ local _let_30_ = input
237
+ local content = _let_30_ [" content" ]
238
+ local range = _let_30_ [" range" ]
239
+ local function _31_ (result )
232
240
return buffer [" append-prefixed-line" ](buf , range [" end" ], comment_prefix , result )
233
241
end
234
- eval_str ({code = content , range = range , origin = (" comment-" .. tag ), [" suppress-hud?" ] = true , [" on-result" ] = _29_ })
242
+ eval_str ({code = content , range = range , origin = (" comment-" .. tag ), [" suppress-hud?" ] = true , [" on-result" ] = _31_ })
235
243
return input
236
244
else
237
245
return nil
@@ -251,9 +259,9 @@ local function comment_word()
251
259
end
252
260
_2amodule_2a [" comment-word" ] = comment_word
253
261
local function word ()
254
- local _let_31_ = extract .word ()
255
- local content = _let_31_ [" content" ]
256
- local range = _let_31_ [" range" ]
262
+ local _let_33_ = extract .word ()
263
+ local content = _let_33_ [" content" ]
264
+ local range = _let_33_ [" range" ]
257
265
if not a [" empty?" ](content ) then
258
266
return eval_str ({code = content , range = range , origin = " word" })
259
267
else
@@ -262,9 +270,9 @@ local function word()
262
270
end
263
271
_2amodule_2a [" word" ] = word
264
272
local function doc_word ()
265
- local _let_33_ = extract .word ()
266
- local content = _let_33_ [" content" ]
267
- local range = _let_33_ [" range" ]
273
+ local _let_35_ = extract .word ()
274
+ local content = _let_35_ [" content" ]
275
+ local range = _let_35_ [" range" ]
268
276
if not a [" empty?" ](content ) then
269
277
return doc_str ({code = content , range = range , origin = " word" })
270
278
else
@@ -273,9 +281,9 @@ local function doc_word()
273
281
end
274
282
_2amodule_2a [" doc-word" ] = doc_word
275
283
local function def_word ()
276
- local _let_35_ = extract .word ()
277
- local content = _let_35_ [" content" ]
278
- local range = _let_35_ [" range" ]
284
+ local _let_37_ = extract .word ()
285
+ local content = _let_37_ [" content" ]
286
+ local range = _let_37_ [" range" ]
279
287
if not a [" empty?" ](content ) then
280
288
return def_str ({code = content , range = range , origin = " word" })
281
289
else
@@ -284,9 +292,9 @@ local function def_word()
284
292
end
285
293
_2amodule_2a [" def-word" ] = def_word
286
294
local function buf ()
287
- local _let_37_ = extract .buf ()
288
- local content = _let_37_ [" content" ]
289
- local range = _let_37_ [" range" ]
295
+ local _let_39_ = extract .buf ()
296
+ local content = _let_39_ [" content" ]
297
+ local range = _let_39_ [" range" ]
290
298
return eval_str ({code = content , range = range , origin = " buf" })
291
299
end
292
300
_2amodule_2a [" buf" ] = buf
@@ -295,16 +303,16 @@ local function command(code)
295
303
end
296
304
_2amodule_2a [" command" ] = command
297
305
local function range (start , _end )
298
- local _let_38_ = extract .range (start , _end )
299
- local content = _let_38_ [" content" ]
300
- local range0 = _let_38_ [" range" ]
306
+ local _let_40_ = extract .range (start , _end )
307
+ local content = _let_40_ [" content" ]
308
+ local range0 = _let_40_ [" range" ]
301
309
return eval_str ({code = content , range = range0 , origin = " range" })
302
310
end
303
311
_2amodule_2a [" range" ] = range
304
312
local function selection (kind )
305
- local _let_39_ = extract .selection ({kind = (kind or nvim .fn .visualmode ()), [" visual?" ] = not kind })
306
- local content = _let_39_ [" content" ]
307
- local range0 = _let_39_ [" range" ]
313
+ local _let_41_ = extract .selection ({kind = (kind or nvim .fn .visualmode ()), [" visual?" ] = not kind })
314
+ local content = _let_41_ [" content" ]
315
+ local range0 = _let_41_ [" range" ]
308
316
return eval_str ({code = content , range = range0 , origin = " selection" })
309
317
end
310
318
_2amodule_2a [" selection" ] = selection
@@ -318,15 +326,15 @@ end
318
326
_2amodule_locals_2a [" wrap-completion-result" ] = wrap_completion_result
319
327
local function completions (prefix , cb )
320
328
local function cb_wrap (results )
321
- local function _42_ ()
322
- local _41_ = config [" get-in" ]({" completion" , " fallback" })
323
- if (nil ~= _41_ ) then
324
- return nvim .call_function (_41_ , {0 , prefix })
329
+ local function _44_ ()
330
+ local _43_ = config [" get-in" ]({" completion" , " fallback" })
331
+ if (nil ~= _43_ ) then
332
+ return nvim .call_function (_43_ , {0 , prefix })
325
333
else
326
- return _41_
334
+ return _43_
327
335
end
328
336
end
329
- return cb (a .map (wrap_completion_result , (results or _42_ ())))
337
+ return cb (a .map (wrap_completion_result , (results or _44_ ())))
330
338
end
331
339
if (" function" == type (client .get (" completions" ))) then
332
340
return client .call (" completions" , assoc_context ({[" file-path" ] = extract [" file-path" ](), prefix = prefix , cb = cb_wrap }))
0 commit comments