Skip to content

Instantly share code, notes, and snippets.

@arp242
Last active February 27, 2017 18:39
Show Gist options
  • Save arp242/1fe1d86745a20e3bfc0e0fccfad07551 to your computer and use it in GitHub Desktop.
Save arp242/1fe1d86745a20e3bfc0e0fccfad07551 to your computer and use it in GitHub Desktop.
Make semicolon wrap around
" http://stackoverflow.com/a/42465336/660921
function! RepeatFind(reverse)
let l:pos = col('.')
let l:reverse = a:reverse == getcharsearch()['forward']
exe 'normal! ' . (l:reverse ? ',' : ';')
if col('.') == l:pos
exe 'normal! ' . (l:reverse ? '$' : '0') . ';,'[l:reverse]
endif
endfunction
nnoremap ; :call RepeatFind(0)<cr>
nnoremap , :call RepeatFind(1)<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment