Skip to content

Commit

Permalink
Update modeline patterns to use github-linguist/linguist#5271
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed Mar 12, 2021
1 parent 818c51c commit a8e1770
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
[Unpublished]
------------------------------------------------------------------------
* __Added:__ Keyword definitions for Vim 8.2.2302
* __Fixed:__ Various [inaccuracies][2] related to modeline matching

[2]: https://github.com/github/linguist/pull/5271


[v1.2.2]
Expand Down
18 changes: 9 additions & 9 deletions grammars/snippet.cson
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ fileTypes: [
firstLineMatch: """(?x)
# Modeline
(?i:
(?:
# Vim
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))
(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:]
(?:filetype|ft|syntax)\\s*=
(snippets?|snipmate|ultisnips?|neosnippet)
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:snippets?|snipmate|ultisnips?|neosnippet)
(?=$|\\s|:)
|
# Emacs
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
(?:snipmate|ultisnips?|neosnippet|vim-?snippets?)
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:snipmate|ultisnips?|neosnippet|vim-?snippets?)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
)
"""
patterns: [include: "#main"]
Expand Down
18 changes: 9 additions & 9 deletions grammars/viml.cson
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ firstLineMatch: """(?x)
|
# Modeline
(?i:
(?:
# Vim/Vi modeline, accounting for all possible variations
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))
(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:]
(?:filetype|ft|syntax)\\s*=
vim
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:vim)
(?=$|\\s|:)
|
# Emacs modeline, assuming a major mode for VimScript even exists
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
(?:Vim|VimL|VimScript)
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:Vim|VimL|VimScript)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
)
"""
foldingStartMarker: "^(?:if|while|for|fu|function|augroup|aug)"
Expand Down

0 comments on commit a8e1770

Please sign in to comment.