summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-05-06 21:21:52 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-06 21:21:52 +0100
commit0b70aeb49d6dfd1879162f202150cb1ed5f024ad (patch)
tree1c6001599938483cc3acd7362038631ae6f58218
parent34a6a3617b5b6ce11372439f14762caddc4b0cea (diff)
downloadvim-git-0b70aeb49d6dfd1879162f202150cb1ed5f024ad.tar.gz
patch 9.0.1519: global 'filetype' is set when detected from file contentv9.0.1519
Problem: Global 'filetype' is set when it is detected from the file content. Solution: Set the local 'filetype' option value.
-rw-r--r--runtime/autoload/dist/script.vim152
-rw-r--r--src/version.c2
2 files changed, 78 insertions, 76 deletions
diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim
index cefc3b241..c3463c6e2 100644
--- a/runtime/autoload/dist/script.vim
+++ b/runtime/autoload/dist/script.vim
@@ -71,131 +71,131 @@ def DetectFromHashBang(firstline: string)
# Z shell scripts
elseif name =~ '^zsh\>'
- set ft=zsh
+ setl ft=zsh
# TCL scripts
elseif name =~ '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>'
- set ft=tcl
+ setl ft=tcl
# Expect scripts
elseif name =~ '^expect\>'
- set ft=expect
+ setl ft=expect
# Gnuplot scripts
elseif name =~ '^gnuplot\>'
- set ft=gnuplot
+ setl ft=gnuplot
# Makefiles
elseif name =~ 'make\>'
- set ft=make
+ setl ft=make
# Pike
elseif name =~ '^pike\%(\>\|[0-9]\)'
- set ft=pike
+ setl ft=pike
# Lua
elseif name =~ 'lua'
- set ft=lua
+ setl ft=lua
# Perl
elseif name =~ 'perl'
- set ft=perl
+ setl ft=perl
# PHP
elseif name =~ 'php'
- set ft=php
+ setl ft=php
# Python
elseif name =~ 'python'
- set ft=python
+ setl ft=python
# Groovy
elseif name =~ '^groovy\>'
- set ft=groovy
+ setl ft=groovy
# Raku
elseif name =~ 'raku'
- set ft=raku
+ setl ft=raku
# Ruby
elseif name =~ 'ruby'
- set ft=ruby
+ setl ft=ruby
# JavaScript
elseif name =~ 'node\(js\)\=\>\|js\>' || name =~ 'rhino\>'
- set ft=javascript
+ setl ft=javascript
# BC calculator
elseif name =~ '^bc\>'
- set ft=bc
+ setl ft=bc
# sed
elseif name =~ 'sed\>'
- set ft=sed
+ setl ft=sed
# OCaml-scripts
elseif name =~ 'ocaml'
- set ft=ocaml
+ setl ft=ocaml
# Awk scripts; also finds "gawk"
elseif name =~ 'awk\>'
- set ft=awk
+ setl ft=awk
# Website MetaLanguage
elseif name =~ 'wml'
- set ft=wml
+ setl ft=wml
# Scheme scripts
elseif name =~ 'scheme'
- set ft=scheme
+ setl ft=scheme
# CFEngine scripts
elseif name =~ 'cfengine'
- set ft=cfengine
+ setl ft=cfengine
# Erlang scripts
elseif name =~ 'escript'
- set ft=erlang
+ setl ft=erlang
# Haskell
elseif name =~ 'haskell'
- set ft=haskell
+ setl ft=haskell
# Scala
elseif name =~ 'scala\>'
- set ft=scala
+ setl ft=scala
# Clojure
elseif name =~ 'clojure'
- set ft=clojure
+ setl ft=clojure
# Free Pascal
elseif name =~ 'instantfpc\>'
- set ft=pascal
+ setl ft=pascal
# Fennel
elseif name =~ 'fennel\>'
- set ft=fennel
+ setl ft=fennel
# MikroTik RouterOS script
elseif name =~ 'rsc\>'
- set ft=routeros
+ setl ft=routeros
# Fish shell
elseif name =~ 'fish\>'
- set ft=fish
+ setl ft=fish
# Gforth
elseif name =~ 'gforth\>'
- set ft=forth
+ setl ft=forth
# Icon
elseif name =~ 'icon\>'
- set ft=icon
+ setl ft=icon
# Guile
elseif name =~ 'guile'
- set ft=scheme
+ setl ft=scheme
endif
enddef
@@ -218,28 +218,28 @@ def DetectFromText(line1: string)
|| "\n" .. line1 .. "\n" .. line2 .. "\n" .. line3 ..
"\n" .. line4 .. "\n" .. line5
=~ '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>'
- set ft=zsh
+ setl ft=zsh
# ELM Mail files
elseif line1 =~ '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$'
- set ft=mail
+ setl ft=mail
# Mason
elseif line1 =~ '^<[%&].*>'
- set ft=mason
+ setl ft=mason
# Vim scripts (must have '" vim' as the first line to trigger this)
elseif line1 =~ '^" *[vV]im$'
- set ft=vim
+ setl ft=vim
# libcxx and libstdc++ standard library headers like "iostream" do not have
# an extension, recognize the Emacs file mode.
elseif line1 =~? '-\*-.*C++.*-\*-'
- set ft=cpp
+ setl ft=cpp
# MOO
elseif line1 =~ '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$'
- set ft=moo
+ setl ft=moo
# Diff file:
# - "diff" in first line (context diff)
@@ -258,11 +258,11 @@ def DetectFromText(line1: string)
|| (line1 =~ '^\*\*\* ' && line2 =~ '^--- ')
|| (line1 =~ '^=== ' && ((line2 =~ '^=\{66\}' && line3 =~ '^--- ' && line4 =~ '^+++') || (line2 =~ '^--- ' && line3 =~ '^+++ ')))
|| (line1 =~ '^=== \(removed\|added\|renamed\|modified\)')
- set ft=diff
+ setl ft=diff
# PostScript Files (must have %!PS as the first line, like a2ps output)
elseif line1 =~ '^%![ \t]*PS'
- set ft=postscr
+ setl ft=postscr
# M4 scripts: Guess there is a line that starts with "dnl".
elseif line1 =~ '^\s*dnl\>'
@@ -270,64 +270,64 @@ def DetectFromText(line1: string)
|| line3 =~ '^\s*dnl\>'
|| line4 =~ '^\s*dnl\>'
|| line5 =~ '^\s*dnl\>'
- set ft=m4
+ setl ft=m4
# AmigaDos scripts
elseif $TERM == "amiga" && (line1 =~ "^;" || line1 =~? '^\.bra')
- set ft=amiga
+ setl ft=amiga
# SiCAD scripts (must have procn or procd as the first line to trigger this)
elseif line1 =~? '^ *proc[nd] *$'
- set ft=sicad
+ setl ft=sicad
# Purify log files start with "**** Purify"
elseif line1 =~ '^\*\*\*\* Purify'
- set ft=purifylog
+ setl ft=purifylog
# XML
elseif line1 =~ '<?\s*xml.*?>'
- set ft=xml
+ setl ft=xml
# XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN")
elseif line1 =~ '\<DTD\s\+XHTML\s'
- set ft=xhtml
+ setl ft=xhtml
# HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
# Avoid "doctype html", used by slim.
elseif line1 =~? '<!DOCTYPE\s\+html\>'
- set ft=html
+ setl ft=html
# PDF
elseif line1 =~ '^%PDF-'
- set ft=pdf
+ setl ft=pdf
# XXD output
elseif line1 =~ '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} '
- set ft=xxd
+ setl ft=xxd
# RCS/CVS log output
elseif line1 =~ '^RCS file:' || line2 =~ '^RCS file:'
- set ft=rcslog
+ setl ft=rcslog
# CVS commit
elseif line2 =~ '^CVS:' || getline("$") =~ '^CVS: '
- set ft=cvs
+ setl ft=cvs
# Prescribe
elseif line1 =~ '^!R!'
- set ft=prescribe
+ setl ft=prescribe
# Send-pr
elseif line1 =~ '^SEND-PR:'
- set ft=sendpr
+ setl ft=sendpr
# SNNS files
elseif line1 =~ '^SNNS network definition file'
- set ft=snnsnet
+ setl ft=snnsnet
elseif line1 =~ '^SNNS pattern definition file'
- set ft=snnspat
+ setl ft=snnspat
elseif line1 =~ '^SNNS result file'
- set ft=snnsres
+ setl ft=snnsres
# Virata
elseif line1 =~ '^%.\{-}[Vv]irata'
@@ -335,81 +335,81 @@ def DetectFromText(line1: string)
|| line3 =~ '^%.\{-}[Vv]irata'
|| line4 =~ '^%.\{-}[Vv]irata'
|| line5 =~ '^%.\{-}[Vv]irata'
- set ft=virata
+ setl ft=virata
# Strace
# inaccurate fast match first, then use accurate slow match
elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:.]* *execve(')
|| line1 =~ '^__libc_start_main'
- set ft=strace
+ setl ft=strace
# VSE JCL
elseif line1 =~ '^\* $$ JOB\>' || line1 =~ '^// *JOB\>'
- set ft=vsejcl
+ setl ft=vsejcl
# TAK and SINDA
elseif line4 =~ 'K & K Associates' || line2 =~ 'TAK 2000'
- set ft=takout
+ setl ft=takout
elseif line3 =~ 'S Y S T E M S I M P R O V E D '
- set ft=sindaout
+ setl ft=sindaout
elseif getline(6) =~ 'Run Date: '
- set ft=takcmp
+ setl ft=takcmp
elseif getline(9) =~ 'Node File 1'
- set ft=sindacmp
+ setl ft=sindacmp
# DNS zone files
elseif line1 .. line2 .. line3 .. line4 =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA'
- set ft=bindzone
+ setl ft=bindzone
# BAAN
elseif line1 =~ '|\*\{1,80}' && line2 =~ 'VRC '
|| line2 =~ '|\*\{1,80}' && line3 =~ 'VRC '
- set ft=baan
+ setl ft=baan
# Valgrind
elseif line1 =~ '^==\d\+== valgrind' || line3 =~ '^==\d\+== Using valgrind'
- set ft=valgrind
+ setl ft=valgrind
# Go docs
elseif line1 =~ '^PACKAGE DOCUMENTATION$'
- set ft=godoc
+ setl ft=godoc
# Renderman Interface Bytestream
elseif line1 =~ '^##RenderMan'
- set ft=rib
+ setl ft=rib
# Scheme scripts
elseif line1 =~ 'exec\s\+\S*scheme' || line2 =~ 'exec\s\+\S*scheme'
- set ft=scheme
+ setl ft=scheme
# Git output
elseif line1 =~ '^\(commit\|tree\|object\) \x\{40,\}\>\|^tag \S\+$'
- set ft=git
+ setl ft=git
# Gprof (gnu profiler)
elseif line1 == 'Flat profile:'
&& line2 == ''
&& line3 =~ '^Each sample counts as .* seconds.$'
- set ft=gprof
+ setl ft=gprof
# Erlang terms
# (See also: http://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html#Choosing-Modes)
elseif line1 =~? '-\*-.*erlang.*-\*-'
- set ft=erlang
+ setl ft=erlang
# YAML
elseif line1 =~ '^%YAML'
- set ft=yaml
+ setl ft=yaml
# MikroTik RouterOS script
elseif line1 =~ '^#.*by RouterOS.*$'
- set ft=routeros
+ setl ft=routeros
# Sed scripts
# #ncomment is allowed but most likely a false positive so require a space
# before any trailing comment text
elseif line1 =~ '^#n\%($\|\s\)'
- set ft=sed
+ setl ft=sed
else
var lnum = 1
@@ -418,7 +418,7 @@ def DetectFromText(line1: string)
endwhile
if getline(lnum) =~ '^Index:\s\+\f\+$'
# CVS diff
- set ft=diff
+ setl ft=diff
# locale input files: Formal Definitions of Cultural Conventions
# filename must be like en_US, fr_FR@euro or en_US.UTF-8
diff --git a/src/version.c b/src/version.c
index cf3532434..2aa0ef718 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1519,
+/**/
1518,
/**/
1517,