Skip to content

Commit

Permalink
Also jump between do/return.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Dec 31, 2024
1 parent 6001ad3 commit 4b216e8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions ftplugin/lean/lean.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if vim.g.loaded_matchit and not vim.b.match_words then
[[\<\%(namespace\|section\)\s\+\([^«»]\{-}\>\|«.\{-}»\):\<end\s\+\1]],
[[^\s*section\s*$:^end\s*$]],
[[\<if\>:\<then\>:\<else\>]],
[[\<do\>:\<return\>]],
})
:join ','
end
Expand Down
28 changes: 28 additions & 0 deletions spec/matchit_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,32 @@ describe('matchit', function()
end
)
)

it(
'jumps between do/return',
helpers.clean_buffer(
[[
example : Nat := Id.run do
let _ ← Id.run do return 1
return 2
]],
function()
vim.cmd.normal '1$'
assert.current_word.is 'do'

vim.cmd.normal '%'
assert.current_line.is ' return 2'

vim.cmd.normal '%'
assert.current_line.is 'example : Nat := Id.run do'

vim.cmd.normal '2gg17|'
assert.current_word.is 'do'

vim.cmd.normal '%'
assert.current_word.is 'return'
assert.current_line.is ' let _ ← Id.run do return 1'
end
)
)
end)

0 comments on commit 4b216e8

Please sign in to comment.