Skip to content

Instantly share code, notes, and snippets.

@yoshikaw
Created March 12, 2018 05:00
Show Gist options
  • Save yoshikaw/e948884ee2cf56e36e653d5052df4877 to your computer and use it in GitHub Desktop.
Save yoshikaw/e948884ee2cf56e36e653d5052df4877 to your computer and use it in GitHub Desktop.
vim blockdiag filetype detection
" blockdiag
autocmd BufRead,BufNewFile *.diag
\ let s:line1 = getline(1) |
\ if s:line1 =~ '\<diagram\|blockdiag\>\s*{' |
\ set filetype=blockdiag |
\ elseif s:line1 =~ '\<seqdiag\>\s*{' |
\ set filetype=seqdiag |
\ elseif s:line1 =~ '\<actdiag\>\s*{' |
\ set filetype=actdiag |
\ elseif s:line1 =~ '\<nwdiag\>\s*{' |
\ set filetype=nwdiag |
\ elseif s:line1 =~ '\<rackdiag\>\s*{' | |
\ set filetype=rackdiag |
\ elseif s:line1 =~ '\<packetdiag\>\s*{' |
\ set filetype=packetdiag |
\ endif |
\ unlet s:line1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment