Skip to content

Commit

Permalink
Merge pull request #133 from kaymmm/selectbullet
Browse files Browse the repository at this point in the history
feat: Add SelectBullet and SelectBulletText functions (#114)
  • Loading branch information
kaymmm authored Oct 10, 2022
2 parents bb2b9f3 + 8acb181 commit 746f92a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions plugin/bullets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,28 @@ fun! s:replace_char_in_line(lnum, chari, item)
call setline(a:lnum, l:before . a:item . l:after)
endfun

fun! s:select_bullet_text(lnum)
let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum))
if l:curr_line != []
let l:startpos = l:curr_line[0].bullet_length + 1
call setpos('.',[0,a:lnum,l:startpos])
normal! v
call setpos('.',[0,a:lnum,len(getline(a:lnum))])
endif
endfun

fun! s:select_bullet_item(lnum)
let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum))
if l:curr_line != []
let l:startpos = len(l:curr_line[0].leading_space) + 1
call setpos('.',[0,a:lnum,l:startpos])
normal! v
call setpos('.',[0,a:lnum,len(getline(a:lnum))])
endif
endfun

command! SelectBullet call <SID>select_bullet_item(line('.'))
command! SelectBulletText call <SID>select_bullet_text(line('.'))
" ------------------------------------------------------- }}}

" Restore previous external compatibility options --------- {{{
Expand Down

0 comments on commit 746f92a

Please sign in to comment.