Closed j-xella closed 2 years ago
Probably it is better to be an option that using chezmoi source-path
, because system(...)
function takes hundreds ms. You can compare startup time via running this:
$ cd path/to/chezmoi.vim
$ git switch main # and call `chezmoi apply` if needed
$ vim --startuptime /tmp/vim-before.log filetype.vim # and exit with `:q`
$ git switch issue-32 # and call `chezmoi apply` if needed
$ vim --startuptime /tmp/vim-after.log filetype.vim # and exit with `:q`
$ tail -n 1 /tmp/vim-before.log /tmp/vim-after.log
In my WSL2 Ubuntu, this shows:
==> /tmp/vim-before.log <==
029.960 000.002: --- VIM STARTED ---
==> /tmp/vim-after.log <==
284.624 000.001: --- VIM STARTED ---
Probably it is better to be an option that using
chezmoi source-path
, becausesystem(...)
function takes hundreds ms. You can compare startup time via running this:
I agree that calling system may make vim start-up longer. However, there is already a way to disable it - if g:chezmoi#source_dir_path
is set before chezmoi.vim is sourced, no system call will be executed. So, for initial users, it would be better if chezmoi.vim was more "clever", IMO, even if it takes some addiitonal milliseconds of vim start-up. And if users are really concerned about vim start-up times, they can always set g:chezmoi#source_dir_path
explicitly in their vimrc
I see, making g:chezmoi#executable_path
trigger of system()
sounds good.
If use executabe()
instead of exists()
for checking and calling g:chezmoi#executable_path
, it allows to set only binary name like chezmoi
so would be easier ? If so, the name g:chezmoi#executable_path
may need to adjustment.
Great. Thank you for the improvement and adding clear description.
This should hopefully fix #32