aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Nyh <henrik@nyh.se>2013-03-16 10:20:25 +0100
committerHenrik Nyh <henrik@nyh.se>2013-03-16 10:20:25 +0100
commitb4c7b84b9c0d4af538b0f5cfdef4e3bb3dc40d61 (patch)
tree3235ea055152a6cb6093ee1f8b6d37caebef4aa2
parent224aa0955a522c59b1f9074199400a5da1a804ce (diff)
Consider "-" a separator just like "_".
This means you can do `set iskeyword+=-` to autocomplete including dashes, but still use CamelCaseMotion for the subparts.
-rw-r--r--autoload/camelcasemotion.vim4
1 files changed, 2 insertions, 2 deletions
diff --git a/autoload/camelcasemotion.vim b/autoload/camelcasemotion.vim
index a0e8e14..d327ab2 100644
--- a/autoload/camelcasemotion.vim
+++ b/autoload/camelcasemotion.vim
@@ -32,7 +32,7 @@ function! s:Move( direction, count, mode )
"call search( '\>\|\(\a\|\d\)\+\ze_', 'We' )
" end of ...
" number | ACRONYM followed by CamelCase or number | CamelCase | underscore_notation | non-keyword | word
- call search( '\d\+\|\u\+\ze\%(\u\l\|\d\)\|\l\+\ze\%(\u\|\d\)\|\u\l\+\|\%(\a\|\d\)\+\ze_\|\%(\k\@!\S\)\+\|\%(_\@!\k\)\+\>', 'We' )
+ call search( '\d\+\|\u\+\ze\%(\u\l\|\d\)\|\l\+\ze\%(\u\|\d\)\|\u\l\+\|\%(\a\|\d\)\+\ze[-_]\|\%(\k\@!\S\)\+\|\%([-_]\@!\k\)\+\>', 'We' )
" Note: word must be defined as '\k\>'; '\>' on its own somehow
" dominates over the previous branch. Plus, \k must exclude the
" underscore, or a trailing one will be incorrectly moved over:
@@ -74,7 +74,7 @@ function! s:Move( direction, count, mode )
"call search( '\<\|\u\(\l\+\|\u\+\ze\u\)\|\d\+\|_\zs\(\a\|\d\)\+', 'W' . l:direction )
" beginning of ...
" word | empty line | non-keyword after whitespaces | non-whitespace after word | number | ACRONYM followed by CamelCase or number | CamelCase | underscore followed by ACRONYM, Camel, lowercase or number
- call search( '\<\D\|^$\|\%(^\|\s\)\+\zs\k\@!\S\|\>\S\|\d\+\|\u\+\ze\%(\u\l\|\d\)\|\u\l\+\|_\zs\%(\u\+\|\u\l\+\|\l\+\|\d\+\)', 'W' . l:direction )
+ call search( '\<\D\|^$\|\%(^\|\s\)\+\zs\k\@!\S\|\>\S\|\d\+\|\u\+\ze\%(\u\l\|\d\)\|\u\l\+\|[-_]\zs\%(\u\+\|\u\l\+\|\l\+\|\d\+\)', 'W' . l:direction )
" Note: word must be defined as '\<\D' to avoid that a word like
" 1234Test is moved over as [1][2]34[T]est instead of [1]234[T]est
" because \< matches with zero width, and \d\+ will then start