Mercurial > vim
comparison runtime/autoload/dist/ft.vim @ 27420:978890380129 v8.2.4238
patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Commit: https://github.com/vim/vim/commit/bd8168c7705e315827642f2976ec59e26b7fe009
Author: =?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com>
Date: Fri Jan 28 14:15:09 2022 +0000
patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Problem: *.tf file could be fileytpe "tf" or "terraform".
Solution: Detect the type from the file contents. (closes https://github.com/vim/vim/issues/9642)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 28 Jan 2022 15:30:03 +0100 |
parents | 9f72ec92d361 |
children | 5825405e4e2c |
comparison
equal
deleted
inserted
replaced
27419:ae3d7c317382 | 27420:978890380129 |
---|---|
860 endif | 860 endif |
861 let lnum = lnum + 1 | 861 let lnum = lnum + 1 |
862 endwhile | 862 endwhile |
863 endfunc | 863 endfunc |
864 | 864 |
865 " Determine if a *.tf file is TF mud client or terraform | |
866 func dist#ft#FTtf() | |
867 let numberOfLines = line('$') | |
868 for i in range(1, numberOfLines) | |
869 let currentLine = trim(getline(i)) | |
870 let firstCharacter = currentLine[0] | |
871 if firstCharacter !=? ";" && firstCharacter !=? "/" && firstCharacter !=? "" | |
872 setf terraform | |
873 return | |
874 endif | |
875 endfor | |
876 setf tf | |
877 endfunc | |
878 | |
879 | |
865 " Restore 'cpoptions' | 880 " Restore 'cpoptions' |
866 let &cpo = s:cpo_save | 881 let &cpo = s:cpo_save |
867 unlet s:cpo_save | 882 unlet s:cpo_save |