aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-03-06 19:04:42 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-03-07 23:14:43 -0500
commit716bebad486a4364ae5383f7c25aa9919f15143a (patch)
tree936f5b1f5c9599ac6d3d8fae7813e005a9fdd794
parent63d8f08b0b04edd110c1b81d0a6e0c3d29ad4464 (diff)
downloadrneovim-716bebad486a4364ae5383f7c25aa9919f15143a.tar.gz
rneovim-716bebad486a4364ae5383f7c25aa9919f15143a.tar.bz2
rneovim-716bebad486a4364ae5383f7c25aa9919f15143a.zip
vim-patch:8.2.0360: yaml files are only recognized by the file extension
Problem: Yaml files are only recognized by the file extension. Solution: Check for a line starting with "%YAML". (Jason Franklin) https://github.com/vim/vim/commit/8eab73132838e977092d7b46f70b4ecf6274fd6a
-rw-r--r--runtime/scripts.vim4
-rw-r--r--src/nvim/testdir/test_filetype.vim1
2 files changed, 5 insertions, 0 deletions
diff --git a/runtime/scripts.vim b/runtime/scripts.vim
index a690431014..c552f0202f 100644
--- a/runtime/scripts.vim
+++ b/runtime/scripts.vim
@@ -376,6 +376,10 @@ else
elseif s:line1 =~? '-\*-.*erlang.*-\*-'
set ft=erlang
+ " YAML
+ elseif s:line1 =~# '^%YAML'
+ set ft=yaml
+
" CVS diff
else
let s:lnum = 1
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 7290cceb0b..9605348389 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -600,6 +600,7 @@ let s:script_checks = {
\ 'haskell': [['#!/path/haskell']],
\ 'cpp': [['// Standard iostream objects -*- C++ -*-'],
\ ['// -*- C++ -*-']],
+ \ 'yaml': [['%YAML 1.2']],
\ }
func Test_script_detection()