alker0/chezmoi.vim

Customized chezmoi source path can not be automatically determined

Closed this issue · 4 comments

chezmoi.vim knows how to look for the chezmoi source path in all the usual places. However, somethimes the location is not usual:

Determining customized source path automatically would be good. However even though if a user will edit that is outside of source path, this plugin should check if it needs process a file name. So the check should not take a lot to keep startup speed. Calling the system(...) vim function takes 100~300ms longer than not call (in my WSL2). Therefore, this plugin should probably have a option of the feature that uses chezmoi source-path, and allow a user to choose from following solutions:

  1. Use .chezmoi.sourceDir template variable in vimrc.tmpl (should add the guide to document).
  2. Set g:chezmoi#source_dir_from_chezmoi_command option (and set g:chezmoi#chezmoi_executable if needed).
  3. Use default source path (this plugin checks as before).

...Supposing that will fix as above, the g:chezmoi#source_dir_from_chezmoi_command sounds too long to me but I don't know how to.

Please see additional commits in my pull request:

  • I system(...) is not called by default any more
  • Default source dir detection now takes .chezmoiroot into account

Looks good. Please see my new comment in your PR. If it doesn't seem to need changes more, I will merge that.

Thanks for a good advice, please see my latest commit in PR that incorporates it. If you have no more comments, please go ahead with the merge.