summaryrefslogtreecommitdiff
path: root/scripts.vim
blob: 5c3e7393abfc7a2361565782734e3fb7225a7b8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
" This detects the presence of the preseed file magic string on the first line
" of a file whenever vim opens it.
"
" I found the vim `:help` a bit thin on how to do it, and thus had to consult
" the following two stackoverflow threads to get it working:
"
"   https://stackoverflow.com/q/54207515/using-a-file-type-plugin-file
"   https://stackoverflow.com/q/5774824/set-filetype-for-none-extension

if did_filetype()   " filetype already set..
    finish      " ..don't do these checks
endif
if getline(1) =~? '^#_preseed_V1'
    setfiletype preseed
    set filetype=preseed
endif