garbas / vim-snipmate

snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim.
www.vim.org/scripts/script.php?script_id=2540
2.01k stars 181 forks source link

.snippets file accept only TAB for identation #290

Closed rodhash closed 2 years ago

rodhash commented 2 years ago

Hello,

Just migrated from vim-snip and found one identation issue. Lemonade helped fix in another repo and it seems the same issue is found here too.. I searched for similar issues but found none, so I'm raising this one

The issue basically is: we can't use space for identation, as soon as I SPACE idented the highlight error was triggered: Screenshot from 2022-09-09 02-13-14

This seems to be a quick and simple solution, updated the syntax file.

So if you're interested in that, just raised the PR #289 allowing the use of SPACE char as well:

Now we can use both, TAB indented or SPACES indented: Screenshot from 2022-09-09 02-13-54

Cheers

ajzafar commented 2 years ago

As I said in the pull request, it's not actually a simple fix as adjusting syntax files does not affect how SnipMate actually operates. Spaces will still be wrong.

While I've had an idea on how to make this more flexible, so that spaces would be allowable, it's nowhere near implementation. Currently I think it makes a lot of sense to stick with the current requirement of hard tabs. The 'listchars' option may help you see where those are or are not.

rodhash commented 2 years ago

I didn't understand what the issue is, but alright.. I'll keep the fix in my local branch while the Space identation isn't allowed here... curious thing is, space identation work fine here, even with the syntax files highlighting them as error

rodhash commented 2 years ago

Anyway thx for the details.. will keep an eye on upstream .. I'm still experimenting with other snippets tools and will check back later

ajzafar commented 2 years ago

@rodhash I am not sure what you're experiencing on your end, but spaces in .snippets files do not work to denote the contents of a snippet. Here's what happens when I try on my end: asciicast