diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-06-29 18:43:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 18:43:56 +0200 |
commit | 1eb9624666a8478d66e693c7f00fc633a6b1b8ca (patch) | |
tree | d0ff784074aab6781b5d702ace1eabbcc5c74140 /runtime/autoload | |
parent | ba583f820655d3d7cf4c85854c0359c54d49ae5a (diff) | |
download | rneovim-1eb9624666a8478d66e693c7f00fc633a6b1b8ca.tar.gz rneovim-1eb9624666a8478d66e693c7f00fc633a6b1b8ca.tar.bz2 rneovim-1eb9624666a8478d66e693c7f00fc633a6b1b8ca.zip |
vim-patch:9.0.0006: not all Visual Basic files are recognized (#19153)
Problem: Not all Visual Basic files are recognized.
Solution: Change detection of *.cls files. (Doug Kearns)
https://github.com/vim/vim/commit/8b5901e2f9466eb6f38f5b251e871f609f65e252
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/dist/ft.vim | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 14dd88b7a8..e7f71e0f78 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -78,22 +78,30 @@ func dist#ft#FTbas() " most frequent FreeBASIC-specific keywords in distro files let fb_keywords = '\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!' - let fb_preproc = '\c^\s*\%(#\a\+\|option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\)' + let fb_preproc = '\c^\s*\%(' .. + \ '#\s*\a\+\|' .. + \ 'option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\|' .. + \ '\%(''\|rem\)\s*\$lang\>\|' .. + \ 'def\%(byte\|longint\|short\|ubyte\|uint\|ulongint\|ushort\)\>' .. + \ '\)' let fb_comment = "^\\s*/'" " OPTION EXPLICIT, without the leading underscore, is common to many dialects let qb64_preproc = '\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)' - let lines = getline(1, min([line("$"), 100])) - - if match(lines, fb_preproc) > -1 || match(lines, fb_comment) > -1 || match(lines, fb_keywords) > -1 - setf freebasic - elseif match(lines, qb64_preproc) > -1 - setf qb64 - elseif match(lines, s:ft_visual_basic_content) > -1 - setf vb - else - setf basic - endif + for lnum in range(1, min([line("$"), 100])) + let line = getline(lnum) + if line =~ s:ft_visual_basic_content + setf vb + return + elseif line =~ fb_preproc || line =~ fb_comment || line =~ fb_keywords + setf freebasic + return + elseif line =~ qb64_preproc + setf qb64 + return + endif + endfor + setf basic endfunc func dist#ft#FTbtm() @@ -131,6 +139,23 @@ func dist#ft#FTcfg() endif endfunc +func dist#ft#FTcls() + if exists("g:filetype_cls") + exe "setf " .. g:filetype_cls + return + endif + + if getline(1) =~ '^%' + setf tex + elseif getline(1)[0] == '#' && getline(1) =~ 'rexx' + setf rexx + elseif getline(1) == 'VERSION 1.0 CLASS' + setf vb + else + setf st + endif +endfunc + func dist#ft#FTlpc() if exists("g:lpc_syntax_for_c") let lnum = 1 |