Skip to content

Commit 617a248

Browse files
committed
feat: add SelectBullet and SelectBulletText functions
1 parent 132251f commit 617a248

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

plugin/bullets.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,28 @@ fun! s:replace_char_in_line(lnum, chari, item)
12901290
call setline(a:lnum, l:before . a:item . l:after)
12911291
endfun
12921292

1293+
fun! s:select_bullet_text(lnum)
1294+
let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum))
1295+
if l:curr_line != []
1296+
let l:startpos = l:curr_line[0].bullet_length + 1
1297+
call setpos('.',[0,a:lnum,l:startpos])
1298+
normal! v
1299+
call setpos('.',[0,a:lnum,len(getline(a:lnum))])
1300+
endif
1301+
endfun
1302+
1303+
fun! s:select_bullet_item(lnum)
1304+
let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum))
1305+
if l:curr_line != []
1306+
let l:startpos = len(l:curr_line[0].leading_space) + 1
1307+
call setpos('.',[0,a:lnum,l:startpos])
1308+
normal! v
1309+
call setpos('.',[0,a:lnum,len(getline(a:lnum))])
1310+
endif
1311+
endfun
1312+
1313+
command! SelectBullet call <SID>select_bullet_item(line('.'))
1314+
command! SelectBulletText call <SID>select_bullet_text(line('.'))
12931315
" ------------------------------------------------------- }}}
12941316

12951317
" Restore previous external compatibility options --------- {{{

0 commit comments

Comments
 (0)