Skip to content

Instantly share code, notes, and snippets.

@cr3a7ure
Last active October 28, 2022 20:17
Show Gist options
  • Save cr3a7ure/7169b4229487369e534435677b062fa1 to your computer and use it in GitHub Desktop.
Save cr3a7ure/7169b4229487369e534435677b062fa1 to your computer and use it in GitHub Desktop.
vimscript select code block inside markdown

I wanted to visual select code blocks inside markdown files, so I wrote this pretty simple script. Someone might find it useful. You can change the symbols as you like in searchpos, but this only works for multiple lines.

function! InsideTicks()
    call searchpos('`', 'b')
    normal! jv
    call searchpos('`', 'W')
    normal! be
endfunction

nnoremap <leader>mc :<c-u>call InsideTicks()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment