Skip to content

Commit 1188cc2

Browse files
committed
Add motion commands for jumping between CriticMarkup
The ]m and [m pair normally maps to jumping between function definitions, but as the Markdown syntax doesn't support this and the broken attempt jumps between open and close braces anyway, overriding it to actually recognize CriticMarkup seems like the best mapping option.
1 parent 8779089 commit 1188cc2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

autoload/criticmarkup.vim

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,16 @@ function! criticmarkup#Critic(args)
7575
endif
7676
endfunction
7777

78+
function! criticmarkup#JumpNext()
79+
exe "normal ".v:count1."/{[-+\\~]\{2}\<CR>"
80+
endfunction
81+
82+
function! criticmarkup#JumpPrevious()
83+
exe "normal ".v:count1."?{[-+\\~]\{2}\<CR>"
84+
endfunction
85+
7886
function! criticmarkup#CriticNext()
79-
exe "normal /{[-+\\~]\\{2}\<cr>"
87+
call criticmarkup#JumpNext()
8088
let op = input("What to do? ", "", "custom,criticmarkup#CriticCompleteFunc")
8189
if op =~ "accept"
8290
call criticmarkup#Accept()
@@ -92,3 +100,6 @@ function! criticmarkup#CriticCompleteFunc(a, c, p)
92100
return ""
93101
endif
94102
endfunction
103+
104+
nmap ]m :call criticmarkup#JumpNext()<CR>
105+
nmap [m :call criticmarkup#JumpPrevious()<CR>

0 commit comments

Comments
 (0)