purescript-contrib / purescript-vim

Syntax highlighting and indentation for PureScript
BSD 2-Clause "Simplified" License
154 stars 35 forks source link

Fix ftdetect sourcing issue #91

Open grauwoelfchen opened 1 year ago

grauwoelfchen commented 1 year ago

Overview

I've just fixed a small problem regarding to the use of aug[roup] in ftdetct.

It seems that that's already surrounded by an internal group by default, then if we define a new group for those au[cmd](s) in ftdetct, that causes a problem at filetype detection in other subsequent plugins.

There are similar fixes also in other vim plugins:

And addition to that, there is an issue related to this topic, for Vint:

Problem

In my case, when I open a Racket file (xxx.rkt), the use of aug[roup] here causes an error like below (maybe racket is the next to purescript in my loaded vim plugins, in alphabetical order?):

Error detected while processing BufRead Autocommands for "*.rkt"..function RacketDetectHashLang[3]..FileType Autocommands for "*".
.function <SNR>21_LoadFTPlugin:
line    3:
E31: No such mapping

This is related to wlangstroth/vim-racket. The error message itself is unfortunately not so helpful, but the Vim doc of :ftdetct mentions like so:

Note that there is no "augroup" command, this has already been done when sourcing your file.

We usally need to surround au[tocmd]s with an aug[roup], but likely don't need so in the ftdetct directory.

UPDATED Apparently, it seems that the reason of the above error is that the use of aug[roup] here causes unexpected unloading of another plugin. In the case on my env (for vim-racket), this part (b:undo_ftplugin) is evaluated.

Changes

Thus, this pull request simply removes an unnecessary aug[roup] in ftdetct, and adds a comment to ignore Vint's rule ProhibitAutocmdWithNoGroup here.

I hope that makes sense!

Checklist: