aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-21 23:12:31 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-21 23:19:16 -0500
commit4bd7f1133ba8dabe4953144db001ca417afebb8e (patch)
treeae1924aab60c09abe732b66e4baf367b9587ea22
parent94cb3b4b3513510893bd9ee4afc00223956e9238 (diff)
downloadrneovim-4bd7f1133ba8dabe4953144db001ca417afebb8e.tar.gz
rneovim-4bd7f1133ba8dabe4953144db001ca417afebb8e.tar.bz2
rneovim-4bd7f1133ba8dabe4953144db001ca417afebb8e.zip
vim-patch:8.2.2384: turtle filetype not recognized
Problem: Turtle filetype not recognized. Solution: Add a rule to detect turtle files. (closes vim/vim#7722) https://github.com/vim/vim/commit/5e6a7aa2b26077775906eb8411952dc6259694de
-rw-r--r--runtime/filetype.vim9
-rw-r--r--src/nvim/testdir/test_filetype.vim17
2 files changed, 24 insertions, 2 deletions
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 9104519451..1343a1fd0b 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1733,8 +1733,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
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 180170fe9a..815827e224 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -692,6 +692,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