Add text objects for list items
I put the function in lst.vim, not base.vim because it uses some functions from lst.vim and because it's list stuff.
This commit is contained in:
parent
e9b1b66807
commit
140d32fcdd
@ -1410,6 +1410,24 @@ function! vimwiki#lst#setup_marker_infos() "{{{
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#lst#TO_list_item(inner, visual) "{{{
|
||||
let lnum = prevnonblank('.')
|
||||
let item = s:get_corresponding_item(lnum)
|
||||
if item.type == 0
|
||||
return
|
||||
endif
|
||||
let from_line = item.lnum
|
||||
if a:inner
|
||||
let to_line = s:get_last_line_of_item(item)
|
||||
else
|
||||
let to_line = s:get_last_line_of_item_incl_children(item)
|
||||
endif
|
||||
normal! V
|
||||
call cursor(to_line, 0)
|
||||
normal! o
|
||||
call cursor(from_line, 0)
|
||||
endfunction "}}}
|
||||
|
||||
fun! vimwiki#lst#fold_level(lnum) "{{{
|
||||
let cur_item = s:get_item(a:lnum)
|
||||
if cur_item.type != 0
|
||||
|
@ -471,6 +471,9 @@ i\ An inner cell in a table.
|
||||
ac A column in a table.
|
||||
ic An inner column in a table.
|
||||
|
||||
al A list item plus it's children.
|
||||
il A single list item.
|
||||
|
||||
|
||||
==============================================================================
|
||||
4. Commands *vimwiki-commands*
|
||||
@ -814,7 +817,7 @@ You can nest and mix the various types: >
|
||||
- Bulleted list item 3
|
||||
|
||||
|
||||
Note that a space after the list item markers (-, *, 1. etc.) are essential
|
||||
Note that a space after the list item markers (-, *, 1. etc.) is essential
|
||||
|
||||
List items can span multiple lines: >
|
||||
* Item 1
|
||||
|
@ -416,6 +416,12 @@ vnoremap <silent><buffer> ac :<C-U>call vimwiki#base#TO_table_col(0, 1)<CR>
|
||||
onoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 0)<CR>
|
||||
vnoremap <silent><buffer> ic :<C-U>call vimwiki#base#TO_table_col(1, 1)<CR>
|
||||
|
||||
onoremap <silent><buffer> al :<C-U>call vimwiki#lst#TO_list_item(0, 0)<CR>
|
||||
vnoremap <silent><buffer> al :<C-U>call vimwiki#lst#TO_list_item(0, 1)<CR>
|
||||
|
||||
onoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 0)<CR>
|
||||
vnoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
|
||||
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user