File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 11local default_opts = { instanceName = " main" , transient = true }
2- local function grug_far_open (opts )
2+ local function grug_far_open (opts , with_visual )
33 local grug_far = require " grug-far"
44 opts = require (" astrocore" ).extend_tbl (default_opts , opts )
55 if not grug_far .has_instance (opts .instanceName ) then
66 grug_far .open (opts )
77 else
8+ if with_visual then
9+ if not opts .prefills then opts .prefills = {} end
10+ opts .prefills .search = grug_far .get_current_visual_selection ()
11+ end
812 grug_far .open_instance (opts .instanceName )
913 if opts .prefills then grug_far .update_instance_prefills (opts .instanceName , opts .prefills , false ) end
1014 end
@@ -61,15 +65,7 @@ return {
6165 end ,
6266 desc = " Replace current word" ,
6367 }
64- maps .x [prefix ] = {
65- function ()
66- local grug_far = require " grug-far"
67- local grug_opts = require (" astrocore" ).extend_tbl (default_opts , { startCursorRow = 4 })
68- if grug_far .has_instance (grug_opts .instanceName ) then grug_far .close_instance (grug_opts .instanceName ) end
69- grug_far .with_visual_selection (grug_opts )
70- end ,
71- desc = " Replace selection" ,
72- }
68+ maps .x [prefix ] = { function () grug_far_open (nil , true ) end , desc = " Replace selection" }
7369 end ,
7470 },
7571 {
You can’t perform that action at this time.
0 commit comments