my configs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.1 KiB

  1. " Try to determine filetype by examining actual file contents; read as little
  2. " as possible, and try to keep things simple and specific to what I typically
  3. " work on, and will expect to be syntax-highlighted.
  4. " Read first line
  5. let s:line = getline(1)
  6. " If it's not a shebang, we're done
  7. if s:line !~# '^#!'
  8. finish
  9. endif
  10. " AWK
  11. if s:line =~# '\<[gm]\=awk\>'
  12. setfiletype awk
  13. " Perl 5
  14. elseif s:line =~# '\<perl5\=\>'
  15. setfiletype perl
  16. " Perl 6
  17. elseif s:line =~# '\<perl6\>'
  18. setfiletype perl6
  19. " PHP
  20. elseif s:line =~# '\<php\>'
  21. setfiletype php
  22. " Python
  23. elseif s:line =~# '\<python[23]\=\>'
  24. setfiletype python
  25. " Ruby
  26. elseif s:line =~# '\<ruby[23]\=\>'
  27. setfiletype ruby
  28. " sed
  29. elseif s:line =~# '\<sed\>'
  30. setfiletype sed
  31. " Bash
  32. elseif s:line =~# '\<bash\>'
  33. let b:is_bash = 1
  34. setfiletype sh
  35. " Korn shell
  36. elseif s:line =~# '\<\%(\ksh\|ksh93\|mksh\|pdksh\)\>'
  37. let b:is_kornshell = 1
  38. setfiletype sh
  39. " POSIX/Bourne shell
  40. elseif s:line =~# '\<sh\>'
  41. let b:is_posix = 1
  42. setfiletype sh
  43. " TCL
  44. elseif s:line =~# '\<\%(tcl\|wish\)\>'
  45. setfiletype tcl
  46. endif