--- /dev/null
+vim9script
+
+# Based on https://vim.fandom.com/wiki/Move_to_next/previous_line_with_same_indentation
+
+export def Do(step: number, diff: number)
+ var l = line(".")
+ var cin = indent(l)
+ var last = line("$")
+ var lin: number
+ while (l > 0 && l <= last)
+ l += step
+ if (strlen(getline(l)) == 0) | continue | endif
+ lin = indent(l)
+ if !(
+ ((diff == 0) && (lin == cin)) ||
+ ((diff == 1) && (lin > cin)) ||
+ ((diff == -1) && (lin < cin))
+ ) | continue | endif
+ cursor(l, lin + 1)
+ return
+ endwhile
+enddef
--- /dev/null
+if exists("*navindent#Do") | finish | endif
+nmap <silent> [- :call navindent#Do(-1, -1)<CR>
+nmap <silent> ]- :call navindent#Do(+1, -1)<CR>
+nmap <silent> [= :call navindent#Do(-1, 0)<CR>
+nmap <silent> ]= :call navindent#Do(+1, 0)<CR>
+nmap <silent> [+ :call navindent#Do(-1, +1)<CR>
+nmap <silent> ]+ :call navindent#Do(+1, +1)<CR>