lists.vim 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. " vim: set fdm=marker et ts=4 sw=4 sts=4:
  2. function! pandoc#keyboard#lists#Init() abort "{{{1
  3. noremap <buffer> <silent> <Plug>(pandoc-keyboard-next-li) :call pandoc#keyboard#lists#NextListItem()<cr>
  4. noremap <buffer> <silent> <Plug>(pandoc-keyboard-prev-li) :call pandoc#keyboard#lists#PrevListItem()<cr>
  5. noremap <buffer> <silent> <Plug>(pandoc-keyboard-cur-li) :call pandoc#keyboard#lists#CurrentListItem()<cr>
  6. noremap <buffer> <silent> <Plug>(pandoc-keyboard-cur-li-parent) :call pandoc#keyboard#lists#CurrentListItemParent()<cr>
  7. noremap <buffer> <silent> <Plug>(pandoc-keyboard-next-li-sibling) :call pandoc#keyboard#lists#NextListItemSibling()<cr>
  8. noremap <buffer> <silent> <Plug>(pandoc-keyboard-prev-li-sibling) :call pandoc#keyboard#lists#PrevListItemSibling()<cr>
  9. noremap <buffer> <silent> <Plug>(pandoc-keyboard-first-li-child) :call pandoc#keyboard#lists#FirstListItemChild()<cr>
  10. noremap <buffer> <silent> <Plug>(pandoc-keyboard-last-li-child) :call pandoc#keyboard#lists#LastListItemChild()<cr>
  11. noremap <buffer> <silent> <Plug>(pandoc-keyboard-nth-li-child) :<C-U>call pandoc#keyboard#lists#GotoNthListItemChild(v:count1)<cr>
  12. if g:pandoc#keyboard#use_default_mappings == 1 && index(g:pandoc#keyboard#blacklist_submodule_mappings, 'lists') == -1
  13. nmap <buffer> <localleader>ln <Plug>(pandoc-keyboard-next-li)
  14. nmap <buffer> <localleader>lp <Plug>(pandoc-keyboard-prev-li)
  15. nmap <buffer> <localleader>ll <Plug>(pandoc-keyboard-cur-li)
  16. nmap <buffer> <localleader>llp <Plug>(pandoc-keyboard-cur-li-parent)
  17. nmap <buffer> <localleader>lsn <Plug>(pandoc-keyboard-next-li-sibling)
  18. nmap <buffer> <localleader>lsp <Plug>(pandoc-keyboard-prev-li-sibling)
  19. nmap <buffer> <localleader>lcf <Plug>(pandoc-keyboard-first-li-child)
  20. nmap <buffer> <localleader>lcl <Plug>(pandoc-keyboard-last-li-child)
  21. nmap <buffer> <localleader>lcn <Plug>(pandoc-keyboard-nth-li-child)
  22. endif
  23. endfunction
  24. " Functions: {{{1
  25. function! pandoc#keyboard#lists#NextListItem() abort "{{{2
  26. call pandoc#keyboard#MovetoLine(markdown#lists#NextListItem())
  27. endfunction
  28. function! pandoc#keyboard#lists#PrevListItem() abort "{{{2
  29. call pandoc#keyboard#MovetoLine(markdown#lists#PrevListItem())
  30. endfunction
  31. function! pandoc#keyboard#lists#CurrentListItem() abort "{{{2
  32. call pandoc#keyboard#MovetoLine(markdown#lists#CurrentListItem())
  33. endfunction
  34. function! pandoc#keyboard#lists#CurrentListItemParent() abort "{{{2
  35. call pandoc#keyboard#MovetoLine(markdown#lists#CurrentListItemParent())
  36. endfunction
  37. function! pandoc#keyboard#lists#NextListItemSibling() abort "{{{2
  38. call pandoc#keyboard#MovetoLine(markdown#lists#NextListItemSibling())
  39. endfunction
  40. function! pandoc#keyboard#lists#PrevListItemSibling() abort "{{{2
  41. call pandoc#keyboard#MovetoLine(markdown#lists#PrevListItemSibling())
  42. endfunction
  43. function! pandoc#keyboard#lists#FirstListItemChild() abort "{{{2
  44. call pandoc#keyboard#MovetoLine(markdown#lists#FirstChild())
  45. endfunction
  46. function! pandoc#keyboard#lists#LastListItemChild() abort "{{{2
  47. call pandoc#keyboard#MovetoLine(markdown#lists#LastChild())
  48. endfunction
  49. function! pandoc#keyboard#lists#GotoNthListItemChild(count) abort "{{{2
  50. call pandoc#keyboard#MovetoLine(markdown#lists#NthChild(a:count))
  51. endfunction