" subwords.vim. Motions and text objects for dealing with subwords. " " A subword is a word within an identifier, like a word within a camelCase " identifer. " " Text object _. This references a "subword" 'a_' is around, which in the case " of snake_case identifier will include the underscores (_). The 'i_' references " the ci_ onoremap (inner-sub-word) exec "norm " . subwords#visual(v:true, v:false) vnoremap (inner-sub-word) exec "norm " . subwords#visual(v:true, v:false) onoremap (around-sub-word) exec "norm " . subwords#visual(v:true, v:true) vnoremap (around-sub-word) exec "norm " . subwords#visual(v:true, v:true) if ! exists('g:subwords_include_bindings') let g:subwords_include_bindings = 1 endif " These mappings are the same as above, except prefer_camel is turned off, so " snake case is used in the case of a conflict. onoremap (inner-sub-word-prefer-snake) exec "norm " . subwords#visual(v:false, v:false) vnoremap (inner-sub-word-prefer-snake) exec "norm " . subwords#visual(v:false, v:false) onoremap (around-sub-word-prefer-snake) exec "norm " . subwords#visual(v:false, v:true) vnoremap (around-sub-word-prefer-snake) exec "norm " . subwords#visual(v:false, v:true) " Movement keys for subwords. These all have prefer_camel set to true, the idea " being it's pretty easy to navigate underscores with f_ and t_, but more " difficult to navigate upper case letters. noremap (next-subword) silent! call subwords#next(v:false, v:true) noremap (prev-subword) silent! call subwords#next(v:false, v:false) vnoremap (next-subword) silent! call subwords#next(visualmode(), v:true) vnoremap (prev-subword) silent! call subwords#next(visualmode(), v:false) noremap (subwords-replace-;) subwords#repeat(';') noremap (subwords-replace-,) subwords#repeat(',') vnoremap (subwords-replace-;) subwords#repeat(';') vnoremap (subwords-replace-,) subwords#repeat(',') noremap (subwords-replace-t) subwords#clear_mark() . "t" noremap (subwords-replace-f) subwords#clear_mark() . "f" noremap (subwords-replace-T) subwords#clear_mark() . "T" noremap (subwords-replace-F) subwords#clear_mark() . "F" if g:subwords_include_bindings onoremap i_ (inner-sub-word-prefer-snake) vnoremap i_ (inner-sub-word-prefer-snake) onoremap a_ (around-sub-word-prefer-snaked) vnoremap a_ (around-sub-word-prefer-snaked) onoremap i- (inner-sub-word) vnoremap i- (inner-sub-word) onoremap a- (around-sub-word) vnoremap a- (around-sub-word) noremap + (next-subword) vnoremap + (next-subword) noremap - (prev-subword) vnoremap - (prev-subword) noremap ; (subwords-replace-;) noremap , (subwords-replace-,) vnoremap ; (subwords-replace-;) vnoremap , (subwords-replace-,) noremap t (subwords-replace-t) noremap T (subwords-replace-T) noremap f (subwords-replace-f) noremap F (subwords-replace-F) endif