@@ -52,8 +52,6 @@ local function is_trace_diagnostic(element)
5252 return element .events and element .events .trace_search
5353end
5454
55-
56-
5755--- Find the path to the first descendant matching a predicate.
5856--- @param element Element the element to search within
5957--- @param predicate fun ( element : Element ): boolean ?
@@ -343,12 +341,16 @@ function Infoview:move_cursor_to_goal(n)
343341 if goal then
344342 n = n - 1
345343 if n == 0 then
346- local goal_path = find_descendant_path (root , function (e ) return e == goal end , root_path )
344+ local goal_path = find_descendant_path (root , function (e )
345+ return e == goal
346+ end , root_path )
347347 if goal_path then
348348 -- Navigate past the goal prefix (e.g. '⊢ ') to the goal expression.
349349 local expr = goal :children ():nth (2 )
350350 local target_path = expr
351- and find_descendant_path (goal , function (e ) return e == expr end , goal_path )
351+ and find_descendant_path (goal , function (e )
352+ return e == expr
353+ end , goal_path )
352354 or goal_path
353355 local pos = renderer :buf_position_from_path (target_path )
354356 if pos then
@@ -390,7 +392,9 @@ function Infoview:__suggestion_path(n)
390392 for suggestion in root :filter (is_suggestion ) do
391393 n = n - 1
392394 if n == 0 then
393- return find_descendant_path (root , function (e ) return e == suggestion end , root_path )
395+ return find_descendant_path (root , function (e )
396+ return e == suggestion
397+ end , root_path )
394398 end
395399 end
396400end
@@ -909,23 +913,43 @@ function Info:new(opts)
909913 iv :__goto (' prev' , is_goal )
910914 end , { desc = ' Move to the previous goal.' })
911915
912- pin_buffer .keymaps :set (' n' , ' <LocalLeader>g' , ' <Plug>(LeanInfoviewGoToGoal)' ,
913- { remap = true , desc = ' Move to the first goal.' })
914- pin_buffer .keymaps :set (' n' , ' ]g' , ' <Plug>(LeanInfoviewNextGoal)' ,
915- { remap = true , desc = ' Move to the next goal.' })
916- pin_buffer .keymaps :set (' n' , ' [g' , ' <Plug>(LeanInfoviewPrevGoal)' ,
917- { remap = true , desc = ' Move to the previous goal.' })
916+ pin_buffer .keymaps :set (
917+ ' n' ,
918+ ' <LocalLeader>g' ,
919+ ' <Plug>(LeanInfoviewGoToGoal)' ,
920+ { remap = true , desc = ' Move to the first goal.' }
921+ )
922+ pin_buffer .keymaps :set (
923+ ' n' ,
924+ ' ]g' ,
925+ ' <Plug>(LeanInfoviewNextGoal)' ,
926+ { remap = true , desc = ' Move to the next goal.' }
927+ )
928+ pin_buffer .keymaps :set (
929+ ' n' ,
930+ ' [g' ,
931+ ' <Plug>(LeanInfoviewPrevGoal)' ,
932+ { remap = true , desc = ' Move to the previous goal.' }
933+ )
918934
919935 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewNextHypothesis)' , function ()
920936 iv :__goto (' next' , is_hypothesis )
921937 end , { desc = ' Move to the next hypothesis.' })
922938 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewPrevHypothesis)' , function ()
923939 iv :__goto (' prev' , is_hypothesis )
924940 end , { desc = ' Move to the previous hypothesis.' })
925- pin_buffer .keymaps :set (' n' , ' ]h' , ' <Plug>(LeanInfoviewNextHypothesis)' ,
926- { remap = true , desc = ' Move to the next hypothesis.' })
927- pin_buffer .keymaps :set (' n' , ' [h' , ' <Plug>(LeanInfoviewPrevHypothesis)' ,
928- { remap = true , desc = ' Move to the previous hypothesis.' })
941+ pin_buffer .keymaps :set (
942+ ' n' ,
943+ ' ]h' ,
944+ ' <Plug>(LeanInfoviewNextHypothesis)' ,
945+ { remap = true , desc = ' Move to the next hypothesis.' }
946+ )
947+ pin_buffer .keymaps :set (
948+ ' n' ,
949+ ' [h' ,
950+ ' <Plug>(LeanInfoviewPrevHypothesis)' ,
951+ { remap = true , desc = ' Move to the previous hypothesis.' }
952+ )
929953
930954 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewGoToSuggestion)' , function ()
931955 iv :move_cursor_to_suggestion ()
@@ -940,42 +964,78 @@ function Info:new(opts)
940964 iv :__goto (' prev' , is_suggestion )
941965 end , { desc = ' Move to the previous suggestion.' })
942966
943- pin_buffer .keymaps :set (' n' , ' <LocalLeader>S' , ' <Plug>(LeanInfoviewGoToSuggestion)' ,
944- { remap = true , desc = ' Move to the first suggestion.' })
945- pin_buffer .keymaps :set (' n' , ' <LocalLeader>s' , ' <Plug>(LeanInfoviewAcceptSuggestion)' ,
946- { remap = true , desc = ' Accept the first suggestion.' })
947- pin_buffer .keymaps :set (' n' , ' ]s' , ' <Plug>(LeanInfoviewNextSuggestion)' ,
948- { remap = true , desc = ' Move to the next suggestion.' })
949- pin_buffer .keymaps :set (' n' , ' [s' , ' <Plug>(LeanInfoviewPrevSuggestion)' ,
950- { remap = true , desc = ' Move to the previous suggestion.' })
967+ pin_buffer .keymaps :set (
968+ ' n' ,
969+ ' <LocalLeader>S' ,
970+ ' <Plug>(LeanInfoviewGoToSuggestion)' ,
971+ { remap = true , desc = ' Move to the first suggestion.' }
972+ )
973+ pin_buffer .keymaps :set (
974+ ' n' ,
975+ ' <LocalLeader>s' ,
976+ ' <Plug>(LeanInfoviewAcceptSuggestion)' ,
977+ { remap = true , desc = ' Accept the first suggestion.' }
978+ )
979+ pin_buffer .keymaps :set (
980+ ' n' ,
981+ ' ]s' ,
982+ ' <Plug>(LeanInfoviewNextSuggestion)' ,
983+ { remap = true , desc = ' Move to the next suggestion.' }
984+ )
985+ pin_buffer .keymaps :set (
986+ ' n' ,
987+ ' [s' ,
988+ ' <Plug>(LeanInfoviewPrevSuggestion)' ,
989+ { remap = true , desc = ' Move to the previous suggestion.' }
990+ )
951991
952992 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewNextLink)' , function ()
953993 iv :__goto (' next' , is_link )
954994 end , { desc = ' Move to the next link.' })
955995 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewPrevLink)' , function ()
956996 iv :__goto (' prev' , is_link )
957997 end , { desc = ' Move to the previous link.' })
958- pin_buffer .keymaps :set (' n' , ' ]l' , ' <Plug>(LeanInfoviewNextLink)' ,
959- { remap = true , desc = ' Move to the next link.' })
960- pin_buffer .keymaps :set (' n' , ' [l' , ' <Plug>(LeanInfoviewPrevLink)' ,
961- { remap = true , desc = ' Move to the previous link.' })
998+ pin_buffer .keymaps :set (
999+ ' n' ,
1000+ ' ]l' ,
1001+ ' <Plug>(LeanInfoviewNextLink)' ,
1002+ { remap = true , desc = ' Move to the next link.' }
1003+ )
1004+ pin_buffer .keymaps :set (
1005+ ' n' ,
1006+ ' [l' ,
1007+ ' <Plug>(LeanInfoviewPrevLink)' ,
1008+ { remap = true , desc = ' Move to the previous link.' }
1009+ )
9621010
9631011 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewTraceSearch)' , function ()
9641012 iv :trace_search ()
9651013 end , { desc = ' Search through trace messages in the diagnostic under the cursor.' })
966- pin_buffer .keymaps :set (' n' , ' <LocalLeader>/' , ' <Plug>(LeanInfoviewTraceSearch)' ,
967- { remap = true , desc = ' Search through trace messages in the diagnostic under the cursor.' })
1014+ pin_buffer .keymaps :set (
1015+ ' n' ,
1016+ ' <LocalLeader>/' ,
1017+ ' <Plug>(LeanInfoviewTraceSearch)' ,
1018+ { remap = true , desc = ' Search through trace messages in the diagnostic under the cursor.' }
1019+ )
9681020
9691021 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewNextTraceDiagnostic)' , function ()
9701022 iv :__goto (' next' , is_trace_diagnostic )
9711023 end , { desc = ' Move to the next trace diagnostic.' })
9721024 pin_buffer .keymaps :set (' n' , ' <Plug>(LeanInfoviewPrevTraceDiagnostic)' , function ()
9731025 iv :__goto (' prev' , is_trace_diagnostic )
9741026 end , { desc = ' Move to the previous trace diagnostic.' })
975- pin_buffer .keymaps :set (' n' , ' ]t' , ' <Plug>(LeanInfoviewNextTraceDiagnostic)' ,
976- { remap = true , desc = ' Move to the next trace diagnostic.' })
977- pin_buffer .keymaps :set (' n' , ' [t' , ' <Plug>(LeanInfoviewPrevTraceDiagnostic)' ,
978- { remap = true , desc = ' Move to the previous trace diagnostic.' })
1027+ pin_buffer .keymaps :set (
1028+ ' n' ,
1029+ ' ]t' ,
1030+ ' <Plug>(LeanInfoviewNextTraceDiagnostic)' ,
1031+ { remap = true , desc = ' Move to the next trace diagnostic.' }
1032+ )
1033+ pin_buffer .keymaps :set (
1034+ ' n' ,
1035+ ' [t' ,
1036+ ' <Plug>(LeanInfoviewPrevTraceDiagnostic)' ,
1037+ { remap = true , desc = ' Move to the previous trace diagnostic.' }
1038+ )
9791039
9801040 -- Show/hide current pin extmark when entering/leaving infoview.
9811041 local pin_augroup = vim .api .nvim_create_augroup (' LeanInfoviewShowPin' , { clear = false })
0 commit comments