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

Fix ftdetect sourcing issue #91

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

grauwoelfchen
Copy link

@grauwoelfchen grauwoelfchen commented Feb 5, 2023

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:

  • Briefly described the change
  • Opened an issue before investing a significant amount of work into changes
  • Updated README.md with any new configuration options and behavior
  • Updated CHANGELOG.md with the proposed changes
  • Ran generate-doc.sh to re-generate the documentation

This change removes an unnecessary aug[roup] in ftdetct. Because the use of
au[tocmd] under ftdetect directory is already surrounded by an aug[roup] by
default. See help :ftdetct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant