Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no snippet with that name #27

Closed
pglaser-engineer opened this issue Mar 3, 2023 · 3 comments
Closed

no snippet with that name #27

pglaser-engineer opened this issue Mar 3, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@pglaser-engineer
Copy link

Hi,

I just got started with joereynolds/vim-minisnip and a decent set of snips from @Gavinok's dotfiles .
It's a wonderful plugin, elegantly simple and doesn't get in my way.

Then I found miniSnip. I would much rather build my snips collection for this modern version. So I am giving it a try.

I installed it with Plug 'Jorengarenar/miniSnip' and configured as follows:

let g:miniSnip_trigger = '<C-g>'
let g:miniSnip_dirs = [  '~/.vim/miniSnip' ]

Per the readme, I created a file foo.snip and placed it in ~/.vim/miniSnip/all.

When I type foo and then hit <C-g>, I get the error message miniSnip: no snippet with that name. I am totally not a vimscript coder, but from looking at the miniSnip#trigger() function, it's pretty clear (I think) that it doesn't matter what is in the file: if it is not found, it isn't parsed.

I cannot figure out what I've done wrong -- I must be missing something simple.

Also, a question. Once I resolve the snip loading issue, the snips I have are for the joereynolds version and therefore have a different syntax from miniSnips. Is miniSnips backwards compatible?

If it is not, and assuming all else is tests well with miniSnip, I will likely convert the older snips to the new syntax. Seems like a small collection like this would make a good addition to miniSnip -- I would be happy to do a pull request if it sounds like such a thing would be useful.

Many thanks for your work on this plugin!
--Phil

@Jorenar Jorenar closed this as completed in 5bc403e Mar 4, 2023
@Jorenar
Copy link
Owner

Jorenar commented Mar 4, 2023

Thanks for the report, should be working now.

By the way, if you are using ~/.vim/miniSnip, the plugin ought to look there automatically if g:miniSnip_dirs is empty, so there's no need to set it.

Is miniSnips backwards compatible?

It's not out of the box, but I made it quite configurable, so for very basic snippets it's theoretically possible to configure it roughly to match the old syntax. Although I never tried to and I suspect rewriting snippet would be easier.

Seems like a small collection like this would make a good addition to miniSnip -- I would be happy to do a pull request if it sounds like such a thing would be useful.

I'm more than happy to put a link to such collection into README like other snippet plugins do, but shipping them by default would be not a good idea since users (including me) would often prefer having their own (and not worrying about overlaps).

@pglaser-engineer
Copy link
Author

Thanks so much for the quick turnaround -- that merge fixed the problem!

I see what you mean about backwards compatibility -- it's rather trivial to convert to the new syntax.

That's the good news.

The bad news is this:

   E117: Unknown function: miniSnip#trigger

The error occurs, of course, when I try to complete a snip name with C-g (my mapping for miniSnip_trigger). This error happens only on macos (Ventura 13.2.1). On arch and manjaro, miniSnip with my revised snips work perfectly fine (although it is a bit slower than vim-minisnips classic).

I am installing as follows:

  Plug 'Jorengarenar/miniSnip'

I suspect the problem has something to with the mixed-case name of miniSnip. In its typical configuration, macos preserves case, but it does not differentiate a mixed case from all lower case file name. I don't know enough about how vim plugins are structured to explain the precise mechanism for the failure to find the function, but given that it works fine on a normal linux distro I cannot think of another explanation.

Incidentally, to avoid this problem for my snipit files, I have the location as follows:

  let g:miniSnip_dirs = [  '~/.vim/minisnip_modern' ]

The reason I had set the value to the default location in my original post of the issue was because i had been experimenting with this kind of thing because of the potential for issues with mixed case.

Does this explanation sound all plausible? Have you run into it before with macos (of course I searched the issues but nothing jumped out at me). Does a workaround come to mind?

Many thanks!
--Phil

@Jorenar
Copy link
Owner

Jorenar commented Mar 7, 2023

Interesting, could you please submit a issue for this too?

@Jorenar Jorenar self-assigned this Mar 15, 2023
@Jorenar Jorenar added the bug Something isn't working label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants