summaryrefslogtreecommitdiffstats
path: root/ftdetect/nftables.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ftdetect/nftables.vim')
-rw-r--r--ftdetect/nftables.vim11
1 files changed, 11 insertions, 0 deletions
diff --git a/ftdetect/nftables.vim b/ftdetect/nftables.vim
new file mode 100644
index 0000000..8936167
--- /dev/null
+++ b/ftdetect/nftables.vim
@@ -0,0 +1,11 @@
+function! s:DetectFiletype()
+ if getline(1) =~# '^#!\s*\%\(/\S\+\)\?/\%\(s\)\?bin/\%\(env\s\+\)\?nft\>'
+ setfiletype nftables
+ endif
+endfunction
+
+augroup nftables
+ autocmd!
+ autocmd BufRead,BufNewFile * call s:DetectFiletype()
+ autocmd BufRead,BufNewFile *.nft,nftables.conf setfiletype nftables
+augroup END