Skip to content

Commit d4453e1

Browse files
committed
Fix multiple leading underscores.
1 parent 0c173c4 commit d4453e1

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

plugin/textobj/variable-segment.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" textobj-variable-segment: a text object for segments of variable names
22
" Author: Julian Berman
3-
" Version: 0.4.0
3+
" Version: 0.5.0
44

55
if exists('g:loaded_textobj_variable_segment')
66
finish
@@ -16,7 +16,7 @@ call textobj#user#plugin('variable', {
1616

1717

1818
function! s:select(object_type, right_boundary)
19-
let left_boundaries = ['_\i', '\<', '\l\u', '\u\u\ze\l', '\a\d', '\d\a']
19+
let left_boundaries = ['_\+\i', '\<', '\l\u', '\u\u\ze\l', '\a\d', '\d\a']
2020
call search(join(left_boundaries, '\|'), 'bce')
2121
let start_position = getpos('.')
2222

t/variable-segment.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ describe 'iv'
8484
Expect getline(1) == '_howManyCoolThings'
8585
end
8686

87+
it 'ignores multiple leading underscores'
88+
put! = '__doCoolThings'
89+
normal! 3|
90+
normal civhowMany
91+
Expect getline(1) == '__howManyCoolThings'
92+
end
93+
8794
it 'selects leading small camels and does not swap case'
8895
put! = 'greatQuuxThings'
8996
normal! 3|
@@ -276,6 +283,13 @@ describe 'av'
276283
Expect getline(1) == '_doThings'
277284
end
278285

286+
it 'ignores multiple leading underscores'
287+
put! = '__doCoolThings'
288+
normal! 3|
289+
normal dav
290+
Expect getline(1) == '__coolThings'
291+
end
292+
279293
it 'selects leading small camels and swaps case'
280294
put! = 'greatQuuxThings'
281295
normal! 3|

0 commit comments

Comments
 (0)