lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
4.86k stars 186 forks source link

fix: help triggering text autocmds #1090

Closed MithicSpirit closed 1 month ago

MithicSpirit commented 1 month ago

The default filetype detection algorithm only checks the last lines of .txt files for "ft=help" before setting the filetype to "text". Since there was an empty line at the end, the help page was getting marked as having filetype text first, and then help, which meant both autocmds were triggered. This fixes that by removing the extraneous newline; note that there is still a newline at the end of file, as is customary, and this just removes the second, unnecessary newline.

Furthermore, this simplifies the logic for "gen_help.lua" and increases its robustness by using the "io.lines" function rather than reading the entire file as a string and using regular expressions to split it into lines.

MithicSpirit commented 1 month ago

oops just realized that this is autogenerated with a script. will try to fix the script instead fixed

lewis6991 commented 1 month ago

Thanks!