diff options
author | Johan Kotlinski <kotlinski@gmail.com> | 2023-04-02 20:29:38 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-04-02 20:29:38 +0100 |
commit | 065088d5549e7711668321cc5a77c9a9b684b142 (patch) | |
tree | 0b7dcfd20a103c30f6487f44b0eda95ce2e298e2 /runtime/autoload | |
parent | 3cdd799951b4d08f987a8346a8de544e41fab3d7 (diff) |
patch 9.0.1438: .fs files are falsely recognized as forth filesv9.0.1438
Problem: .fs files are falsely recognized as forth files.
Solution: Check 100 lines for something that looks like forth. (Johan
Kotlinski, closes #12219, closes #11988)
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/dist/ft.vim | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index bfc325d240..5d2053d70a 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -307,14 +307,16 @@ export def FTfs() if exists("g:filetype_fs") exe "setf " .. g:filetype_fs else - var line = getline(nextnonblank(1)) - # comments and colon definitions - if line =~ '^\s*\.\=( ' || line =~ '^\s*\\G\= ' || line =~ '^\\$' - \ || line =~ '^\s*: \S' - setf forth - else - setf fsharp - endif + var n = 1 + while n < 100 && n <= line("$") + # Forth comments and colon definitions + if getline(n) =~ "^[:(\\\\] " + setf forth + return + endif + n += 1 + endwhile + setf fsharp endif enddef |