Skip to content

Commit 0c173c4

Browse files
committed
Fix single letter sections.
1 parent 4277c09 commit 0c173c4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

plugin/textobj/variable-segment.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
@@ -147,6 +147,13 @@ describe 'iv'
147147
Expect getline(1) == 'helloBeautiful'
148148
end
149149

150+
it 'selects single letter camel sections'
151+
put! = 'aThingILike'
152+
normal! 0
153+
normal civthe
154+
Expect getline(1) == 'theThingILike'
155+
end
156+
150157
it 'does not cross left snake boundaries'
151158
put! = 'foo_bar baz_quux'
152159
normal! 10|
@@ -339,6 +346,13 @@ describe 'av'
339346
Expect getline(1) == 'hello'
340347
end
341348

349+
it 'selects single letter camel sections'
350+
put! = 'aThingILike'
351+
normal! 0
352+
normal dav
353+
Expect getline(1) == 'thingILike'
354+
end
355+
342356
it 'does not cross left snake boundaries'
343357
put! = 'foo_bar baz_quux'
344358
normal! 10|

0 commit comments

Comments
 (0)