aboutsummaryrefslogtreecommitdiff
path: root/vim/scripts.vim
blob: 3c3c53cd1a507afe40586fb298afe465fa09e476 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
" Try to determine filetype by examining actual file contents; read as little
" as possible, and try to keep things simple and specific to what I typically
" work on, and will expect to be syntax-highlighted.

" Read first line
let s:line = getline(1)

" If it's not a shebang, we're done
if s:line !~# '^#!'
  finish

" AWK
elseif s:line =~# '\<[gm]\=awk\d*\>'
  setfiletype awk

" Perl 5
elseif s:line =~# '\<perl5\=\>'
  setfiletype perl

" Perl 6
elseif s:line =~# '\<perl6\>'
  setfiletype perl6

" PHP
elseif s:line =~# '\<php\d*\>'
  setfiletype php

" Python
elseif s:line =~# '\<python\d*\>'
  setfiletype python

" Ruby
elseif s:line =~# '\<ruby\d*\>'
  setfiletype ruby

" sed
elseif s:line =~# '\<sed\d*\>'
  setfiletype sed

" Bash
elseif s:line =~# '\<bash\d*\>'
  let b:is_bash = 1
  setfiletype sh

" Korn shell; either starts or ends in 'ksh'
elseif s:line =~# '\<ksh\|ksh\d*\>'
  let b:is_kornshell = 1
  setfiletype sh

" POSIX/Bourne shell
elseif s:line =~# '\<sh\>'
  let b:is_posix = 1
  setfiletype sh

" TCL
elseif s:line =~# '\<\%(expect\|tcl\|wish\)\d*\>'
  setfiletype tcl

endif