Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How can I CamelCase-enable Vim Search
- nnoremap <expr> <leader>/ SearchCamelCase('/')
- nnoremap <expr> <leader>? SearchCamelCase('?')
- function! SearchCamelCase(dir)
- call inputsave()
- let ab = input(a:dir)
- call inputrestore()
- let l = filter(split(toupper(ab), 'zs'), 'v:val =~ "\w"')
- if len(l) > 0
- let l[0] = '[' . l[0] . tolower(l[0]) . ']'
- end
- let @/ = 'C<' . join(map(l, 'v:val . "[0-9a-z_]*"'), '') . '>'
- return a:dir . "r"
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment