Skip to content

Commit 746f92a

Browse files
authored
Merge pull request #133 from kaymmm/selectbullet
feat: Add SelectBullet and SelectBulletText functions (#114)
2 parents bb2b9f3 + 8acb181 commit 746f92a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

plugin/bullets.vim

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

1318+
fun! s:select_bullet_text(lnum)
1319+
let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum))
1320+
if l:curr_line != []
1321+
let l:startpos = l:curr_line[0].bullet_length + 1
1322+
call setpos('.',[0,a:lnum,l:startpos])
1323+
normal! v
1324+
call setpos('.',[0,a:lnum,len(getline(a:lnum))])
1325+
endif
1326+
endfun
1327+
1328+
fun! s:select_bullet_item(lnum)
1329+
let l:curr_line = s:parse_bullet(a:lnum, getline(a:lnum))
1330+
if l:curr_line != []
1331+
let l:startpos = len(l:curr_line[0].leading_space) + 1
1332+
call setpos('.',[0,a:lnum,l:startpos])
1333+
normal! v
1334+
call setpos('.',[0,a:lnum,len(getline(a:lnum))])
1335+
endif
1336+
endfun
1337+
1338+
command! SelectBullet call <SID>select_bullet_item(line('.'))
1339+
command! SelectBulletText call <SID>select_bullet_text(line('.'))
13181340
" ------------------------------------------------------- }}}
13191341

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

0 commit comments

Comments
 (0)