diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2021-01-14 20:59:40 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2021-01-14 20:59:40 +0100 |
commit | 22040ce638ed610cfdbba03376ad9864a2a5d321 (patch) | |
tree | 43e3ef7cc1a17994bbf1460d0d000dd7e0723168 /autoload/polyglot/ft.vim | |
parent | 7bde552a463999897320a1899a6ca4f8806041ea (diff) | |
download | vim-polyglot-22040ce638ed610cfdbba03376ad9864a2a5d321.tar.gz vim-polyglot-22040ce638ed610cfdbba03376ad9864a2a5d321.zip |
Update
Diffstat (limited to 'autoload/polyglot/ft.vim')
-rw-r--r-- | autoload/polyglot/ft.vim | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/autoload/polyglot/ft.vim b/autoload/polyglot/ft.vim index 35812c37..f872bf9c 100644 --- a/autoload/polyglot/ft.vim +++ b/autoload/polyglot/ft.vim @@ -362,6 +362,10 @@ func polyglot#ft#FTinc() setf aspvbs elseif lines =~ "<?" setf php + " Pascal supports // comments but they're vary rarely used for file + " headers so assume POV-Ray + elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? s:ft_pascal_keywords + setf pascal else call polyglot#ft#FTasmsyntax() if exists("b:asmsyntax") @@ -408,6 +412,9 @@ func polyglot#ft#FTprogress_asm() setf progress endfunc +let s:ft_pascal_comments = '^\s*\%({\|(\*\|//\)' +let s:ft_pascal_keywords = '^\s*\%(program\|unit\|library\|uses\|begin\|procedure\|function\|const\|type\|var\)\>' + func polyglot#ft#FTprogress_pascal() if exists("g:filetype_p") exe "setf " . g:filetype_p @@ -419,8 +426,7 @@ func polyglot#ft#FTprogress_pascal() let lnum = 1 while lnum <= 10 && lnum < line('$') let line = getline(lnum) - if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>' - \ || line =~ '^\s*{' || line =~ '^\s*(\*' + if line =~ s:ft_pascal_comments || line =~? s:ft_pascal_keywords setf pascal return elseif line !~ '^\s*$' || line =~ '^/\*' @@ -433,6 +439,19 @@ func polyglot#ft#FTprogress_pascal() setf progress endfunc +func polyglot#ft#FTpp() + if exists("g:filetype_pp") + exe "setf " . g:filetype_pp + else + let line = getline(nextnonblank(1)) + if line =~ s:ft_pascal_comments || line =~? s:ft_pascal_keywords + setf pascal + else + setf puppet + endif + endif +endfunc + func polyglot#ft#FTr() let max = line("$") > 50 ? 50 : line("$") |