@@ -213,91 +213,45 @@ function M.zoom_toggle()
213213 vim .t .zoomed = true
214214end
215215
216- local function ensure_incsearch_core ()
217- if fn .exists " *incsearch#util#deepextend" == 1 then
218- return true
219- end
216+ local hop_warning_shown = false
220217
221- local ok , lazy = pcall (require , " lazy" )
218+ local function load_hop ()
219+ local ok , hop = pcall (require , " hop" )
222220 if ok then
223- lazy .load { plugins = { " incsearch.vim" } }
224- end
225-
226- return fn .exists " *incsearch#util#deepextend" == 1
227- end
228-
229- local function ensure_incsearch_easymotion ()
230- if fn .exists " *incsearch#config#easymotion#module" == 1 then
231- return true
221+ return hop
232222 end
233223
234- local ok , lazy = pcall (require , " lazy" )
235- if ok then
236- lazy .load { plugins = { " incsearch-easymotion.vim" } }
224+ if not hop_warning_shown then
225+ hop_warning_shown = true
226+ vim .schedule (function ()
227+ vim .notify (" hop.nvim is not available; search mappings will fall back to their defaults" , vim .log .levels .WARN , {
228+ title = " hop" ,
229+ })
230+ end )
237231 end
238232
239- return fn . exists " *incsearch#config#easymotion#module " == 1
233+ return nil
240234end
241235
242- local function warn_once (msg )
243- vim .schedule (function ()
244- vim .notify (msg , vim .log .levels .WARN , { title = " incsearch" })
245- end )
246- end
247-
248- function M .incsearch_config (opts )
249- opts = opts or {}
250-
251- local modules = {}
252- if ensure_incsearch_easymotion () then
253- table.insert (modules , fn [" incsearch#config#easymotion#module" ]())
254- else
255- warn_once " incsearch-easymotion.vim is not available; incremental search will fall back to the default behaviour"
256- end
257-
258- local base = {
259- is_expr = 0 ,
260- }
261-
262- if # modules > 0 then
263- base .modules = modules
264- base .keymap = { [" <CR>" ] = " <Over>(easymotion)" }
265- else
266- base .keymap = vim .empty_dict ()
267- end
268-
269- if ensure_incsearch_core () then
270- local ok , extended = pcall (fn [" incsearch#util#deepextend" ], vim .deepcopy (base ), opts )
271- if ok then
272- return extended
273- end
274- warn_once (string.format (" incsearch#util#deepextend failed: %s; falling back to Lua deep extend" , extended ))
275- else
276- warn_once " incsearch.vim is not available; incremental search will fall back to Lua deep extend"
236+ function M .hop_patterns (opts )
237+ local hop = load_hop ()
238+ if hop then
239+ hop .hint_patterns (opts or {})
240+ return true
277241 end
278-
279- return vim .tbl_deep_extend (" force" , vim .deepcopy (base ), opts )
242+ return false
280243end
281244
282- function M .legacy_incsearch_config (opts )
283- return M .incsearch_config (opts or {})
284- end
285-
286- function M .incsearch_keymap ()
287- if fn .exists " :IncSearchNoreMap" == 0 then
288- return
289- end
290-
291- local function map (lhs , rhs )
292- vim .cmd (string.format ([[ IncSearchNoreMap %s %s]] , lhs , rhs ))
245+ function M .hop_char1 (opts )
246+ local hop = load_hop ()
247+ if hop then
248+ hop .hint_char1 (opts or {})
249+ return true
293250 end
294-
295- map (" <Right>" , " <Over>(incsearch-next)" )
296- map (" <Left>" , " <Over>(incsearch-prev)" )
297- map (" <Tab>" , " <Over>(incsearch-scroll-f)" )
298- map (" <S-Tab>" , " <Over>(incsearch-scroll-b)" )
251+ return false
299252end
300253
254+
301255function M .print_foobar ()
302256 vim .notify (" Foo Bar!" , vim .log .levels .INFO , { title = " CtrlSpace" })
303257end
0 commit comments