]> granicus.if.org Git - vim/commitdiff
patch 8.2.2384: turtle filetype not recognized v8.2.2384
authorBram Moolenaar <Bram@vim.org>
Thu, 21 Jan 2021 13:45:13 +0000 (14:45 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 21 Jan 2021 13:45:13 +0000 (14:45 +0100)
Problem:    Turtle filetype not recognized.
Solution:   Add a rule to detect turtle files. (closes #7722)

runtime/filetype.vim
src/testdir/test_filetype.vim
src/version.c

index 4c419ed0604b8d6eb750f94b399c1bc2557a898d..c9c9fdf715662b981902ae602b4912fcba7e7c22 100644 (file)
@@ -1731,8 +1731,13 @@ au BufNewFile,BufRead *.tli                      setf tli
 " Telix Salt
 au BufNewFile,BufRead *.slt                    setf tsalt
 
-" Tera Term Language
-au BufRead,BufNewFile *.ttl                    setf teraterm
+" Tera Term Language or Turtle
+au BufRead,BufNewFile *.ttl
+       \ if getline(1) =~ '^@\?\(prefix\|base\)' |
+       \   setf turtle |
+       \ else |
+       \   setf teraterm |
+       \ endif
 
 " Terminfo
 au BufNewFile,BufRead *.ti                     setf terminfo
index b05c152dc6056409d2eed94495bd024990b9dd34..4e6d4331a33eae2c1c70e7ecbaa1289bdfe1256f 100644 (file)
@@ -733,6 +733,23 @@ func Test_ts_file()
   filetype off
 endfunc
 
+func Test_ttl_file()
+  filetype on
+
+  call writefile(['@base <http://example.org/> .'], 'Xfile.ttl')
+  split Xfile.ttl
+  call assert_equal('turtle', &filetype)
+  bwipe!
+
+  call writefile(['looks like Tera Term Language'], 'Xfile.ttl')
+  split Xfile.ttl
+  call assert_equal('teraterm', &filetype)
+  bwipe!
+
+  call delete('Xfile.ttl')
+  filetype off
+endfunc
+
 func Test_pp_file()
   filetype on
 
index 361ae36fc7c992e41a04a65e8e3856388d6471ff..a90c645382fdfb62c88646ab48b0c7537f97b496 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2384,
 /**/
     2383,
 /**/