bkad / CamelCaseMotion

A vim script to provide CamelCase motion through words (fork of inkarkat's camelcasemotion script)
589 stars 45 forks source link

CreateMotionMappings on vimrc does not work with packpath #39

Closed dllud closed 5 years ago

dllud commented 5 years ago

Installing this plugin on vim's packpath and then following the usage instructions that tell you to add call camelcasemotion#CreateMotionMappings('<leader>') into vimrc does not work. I get the following error:

E117: Unknown function: camelcasemotion#CreateMotionMappings

This seems to come from the fact that all plugins are sourced after your vimrc.

My current workaround was to place the CreateMotionMappings call on a file that is sourced after all plugins: ~/.vim/after/plugin/camelcase.vim

This is not ideal, as I would like to keep all my configs in vimrc. I think you should modify your plugin to have it read a global variable (as virtually all other plugins do), e.g.:

let g:camelcasemotion_key = '<leader>'

Or you could have the plugin itself always running the CreateMotionMappings function unless the mappings are overridden on vimrc.

bkad commented 5 years ago

Sorry for the delay! Your suggestion is excellent and I implemented it word for word, using g:camelcasemotion_key.

dllud commented 5 years ago

Thanks a lot! I just tested and it is working fine.