aperezdc / vim-template

Simple templates plugin for Vim
371 stars 153 forks source link

For some reason it is not working #107

Closed jimzenn closed 8 years ago

jimzenn commented 8 years ago

I install the plugin with vim-plug. It worked before, but somehow it does not work any more. Any one with me?

muff1nman commented 8 years ago

Can you provide a bit more detail? What platform? Whats not working? Also it would be helpful to put let g:templates_debug = 1 into your vimrc and then send us the output of :messages

jimzenn commented 8 years ago

There seem to be no messages except

Messages Maintainer: Bram Moolenaar <Bram@vim.org>

Which is not very useful.

Sorry for providing such limited information, but there is no hint or error message.

I'll try to find out what causes this problem. Thank you for your response!

muff1nman commented 8 years ago

Also, you could try:

vim -V9vim-template.log test.txt

and send us that output.

jimzenn commented 8 years ago

Now I get the log.

Executing `find -L '/Users/Jim/Code/test/' -maxdepth 1 -type f -name '.vim-template:*'`
Executing `find -L '/Users/Jim/Code/' -maxdepth 1 -type f -name '.vim-template:*'`
Executing `find -L '/Users/Jim/' -maxdepth 1 -type f -name '.vim-template:*'`
Executing `find -L '/Users/' -maxdepth 1 -type f -name '.vim-template:*'`
Executing `find -L '/' -maxdepth 1 -type f -name '.vim-template:*'`
Executing `find -L '/Users/Jim/.config/haskell-vim-now/.vim/bundle/vim-template/templates/' -maxdepth 1 -type f -name '=vim-template=*'`
No template found
screen shot 2016-07-14 at 08 40 08

As you see it can not find the templates, but I'm sure the templates are there in the last directory.

screen shot 2016-07-14 at 08 41 49
muff1nman commented 8 years ago

Okay I see what the issue is. It looks like the builtin templates are using the g:templates_global_name_prefix variable that was changed to .vim-template: in your config. This is actually right in line with the discussion in #106. But you mentioned this worked at some point with your config?

Regardless I definitely think this is something we are going to look to change.

jimzenn commented 8 years ago

I never changed g:templates_global_name_prefix to .vim-template: by myself, and I searched my .vimrc file, I don't find this variable.

Plus, it is finding =template= in /Users/Jim/.config/haskell-vim-now/.vim/bundle/vim-template/templates/.

Am I understanding it correctly? How should I fix this?

jimzenn commented 8 years ago

Could you help me about this?

dbellavista commented 8 years ago

@Jim-Zenn I am experiencing this problem using Mac OS since forever. I think the find command (in addition to be terribly slow) isn't properly working. So I just stick with revision d930746 which works just fine.

aperezdc commented 8 years ago

@dbellavista Wow, that is quite an old revision... Thing is, we have this in the code:

    " Use find if possible as it will also get hidden files on nix systems. Use
    " builtin glob as a fallback
    if executable("find") && !has("win32") && !has("win64")

...so maybe we can also add && !g:template_do_not_use_find as one additional condition there.

I am still puzzled about this usage of find not working in Mac OS (yes, I'll keep using that spelling), even when according to the manual page the flags being used have the same meaning as in GNU/Linux. Ultimately it would be great to figure out what's going on, but I think we can have an option as workaround in the meantime.

dbellavista commented 8 years ago

@aperezdc Oh my... I actually just redo the same debug I've done 10 month ago ( https://github.com/aperezdc/vim-template/issues/92 ) I can confirm that using Fish Shell (the bastard) the vim command

:glob("`find`")

is not executed correctly since fish has deprecated backtick expansion. There is nothing wrong with macOS (right, we should use the right spelling :) )

Sooo... the solution is to set the shell to /bin/bash or via environemnt or by inserting set shell=/bin/bash on the top of your .vimrc.

@Jim-Zenn is there a change you are using some esoteric shell instead of the standard bash/zsh ?

jimzenn commented 8 years ago

I almost forgot this issue already... I don't know since when this plug-in start to work again. I didn't remember what I did.

Just now, I tested this plugin again under both fish and zsh. It works fine in both shell even without set shell=/bin/bash.

aperezdc commented 8 years ago

@dbellavista @Jim-Zenn Thanks for confirming that the plugin is now working for you. Probably we could add a FAQ section to the documentation, but for now I'll close this issue provided that the issue is no more.