summaryrefslogtreecommitdiff
path: root/scripts.vim
diff options
context:
space:
mode:
Diffstat (limited to 'scripts.vim')
-rw-r--r--scripts.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts.vim b/scripts.vim
new file mode 100644
index 0000000..5c3e739
--- /dev/null
+++ b/scripts.vim
@@ -0,0 +1,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