If you use vim, you know and love its word commands (w
, b
, daw
, ...).
However, sometimes the vim word does not match the words you're working with.
This plugin fills in the gaps.
Compatible with:
- nvim (0.5-dev)
- vim (8.2 and maybe before)
Use miniwords when a vim word is too big, like when you want to navigate by
camelCase
, PascalCase
, snake_case
, and kebab-case
words.
Map keys to <plug>(polyword-miniword-[command])
to work with miniwords.
w
, b
, e
, ge
, iw
, and aw
are all supported
Consider adding "-" to your iskeyword
value. This means that w
will always
go to the next full word and whatever you map to <plug>(polyword-miniword-w)
will go to the next mini-word.
Transform names between the different case styles. Map keys to any of these mappings:
<plug>(polyword-transform-camel)
-- transform names tocamelCase
<plug>(polyword-transform-pascal)
-- transform names toPascalCase
<plug>(polyword-transform-snake)
-- transform names tosnake_case
<plug>(polyword-transform-kebab)
-- transform names tokebab-case
<plug>(polyword-transform-snake-upper)
-- transform names toSNAKE_CASE
<plug>(polyword-transform-kebab-upper)
-- transform names toKEBAB-CASE
Use megawords when a vim word is too small, like when you want to delete an
entire object.value
or Class::attribute
name. Megawords work exactly
like a vim word, but they temporarily add :
and .
to the iskeyword
option.
Map keys to <plug>(polyword-megaword-[command])
to work with megawords.
w
, b
, e
, ge
, iw
, and aw
are all supported
Consider mapping the uppercase letters to megawords (W
, B
, iW
etc). I
find this more useful than the default vim WORD motions that are mapped to
those keys.
map <leader>w <plug>(polyword-miniword-w)
map <leader>b <plug>(polyword-miniword-b)
map <leader>e <plug>(polyword-miniword-e)
map <leader>ge <plug>(polyword-miniword-ge)
omap im <plug>(polyword-miniword-iw)
omap am <plug>(polyword-miniword-aw)
map <leader>W <plug>(polyword-megaword-w)
map <leader>B <plug>(polyword-megaword-b)
map <leader>E <plug>(polyword-megaword-e)
map <leader>gE <plug>(polyword-megaword-ge)
omap iW <plug>(polyword-megaword-iw)
omap aW <plug>(polyword-megaword-aw)
map <leader>nc <plug>(polyword-transform-camel)
map <leader>nC <plug>(polyword-transform-pascal)
map <leader>ns <plug>(polyword-transform-snake)
map <leader>nS <plug>(polyword-transform-snake-upper)
map <leader>nk <plug>(polyword-transform-kebab)
map <leader>nK <plug>(polyword-transform-kebab-upper)