Since I began using git to track my personal configuration inside of ~/.space-vim/private/, I'd sometimes run into this weird misbehavior where upon starting $ nvim, it'd be blocked by vim echoing messages like shown in the screenshot below:
This required me to press enter in order to start using the editor. Functionally it's not a huge deal, but can nonetheless be a bit unpleasant to deal with. And indeed, inside vim, :echo g:spacevim.private showed ['.git'].
The thing that I found really strange was that this problem would only happen occasionally. Upon investigation, it turned to be caused by the slight difference in behavior b/w s:init and s:py_init in the cache.vim script. The former uses globpath to obtain the contents of a given directory, which much like a Unix shell glob, ignores hidden files and dirs; while the latter uses os.listdir, which includes hidden files and dirs as part of its return.
For my purposes of ensuring space-vim ignores the .git directory under private/, it was enough to just do something like:
private = [f for f in os.listdir(private_base) if os.path.isdir(os.path.join(private_base, f)) and not f.startswith('.')] (the last conditional checking a file not starting with . would be enough to fix my problem).
But I thought it better to make the behavior of both s:init and s:py_init uniform wrt globbing, hence this PR.
Since I began using git to track my personal configuration inside of![image](https://user-images.githubusercontent.com/12605746/100494160-06010c80-310d-11eb-978b-5ead668b85ab.png)
~/.space-vim/private/
, I'd sometimes run into this weird misbehavior where upon starting$ nvim
, it'd be blocked by vim echoing messages like shown in the screenshot below:This required me to press enter in order to start using the editor. Functionally it's not a huge deal, but can nonetheless be a bit unpleasant to deal with. And indeed, inside vim,
:echo g:spacevim.private
showed['.git']
.The thing that I found really strange was that this problem would only happen occasionally. Upon investigation, it turned to be caused by the slight difference in behavior b/w
s:init
ands:py_init
in thecache.vim
script. The former usesglobpath
to obtain the contents of a given directory, which much like a Unix shell glob, ignores hidden files and dirs; while the latter usesos.listdir
, which includes hidden files and dirs as part of its return.For my purposes of ensuring space-vim ignores the
.git
directory underprivate/
, it was enough to just do something like:private = [f for f in os.listdir(private_base) if os.path.isdir(os.path.join(private_base, f)) and not f.startswith('.')]
(the last conditional checking a file not starting with.
would be enough to fix my problem).But I thought it better to make the behavior of both
s:init
ands:py_init
uniform wrt globbing, hence this PR.