Add [[ and ]] maps

Hat tip to Joe Reynolds for the idea.
This commit is contained in:
Tim Pope
2020-01-30 11:52:15 -05:00
parent 4e25b2f606
commit 191438f358

View File

@@ -19,6 +19,14 @@ else
let b:undo_ftplugin = "setl cms< com< fo< flp<"
endif
if !exists("g:no_plugin_maps") || !exists("g:no_markdown_maps")
nnoremap <silent><buffer> [[ m':call search('^#\{1,5\}\s\+\S', "bW")<CR>
nnoremap <silent><buffer> ]] m':call search('^#\{1,5\}\s\+\S', "W")<CR>
xnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^#\{1,5\}\s\+\S', "bW")<CR>
xnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^#\{1,5\}\s\+\S', "W")<CR>
let b:undo_ftplugin .= '|sil! nunmap <buffer> [[|sil! nunmap <buffer> ]]|sil! xunmap <buffer> [[|sil! xunmap <buffer> ]]'
endif
function! s:NotCodeBlock(lnum) abort
return synIDattr(synID(v:lnum, 1, 1), 'name') !=# 'markdownCode'
endfunction