File: scripts.vim

package info (click to toggle)
vim-rt 5.3-12
  • links: PTS
  • area: main
  • in suites: slink
  • size: 3,172 kB
  • ctags: 815
  • sloc: makefile: 857; awk: 778; ansic: 379; perl: 192; sh: 167
file content (101 lines) | stat: -rw-r--r-- 2,927 bytes parent folder | download
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
" Vim syntax support file
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	1998 April 14

" This file is called by an autocommand for every file that has just been
" loaded into a buffer.  It checks if the first line of the file is recognized
" as a file for which syntax highlighting is supported.  Only do this if there
" was no match with a filename extension.

if !has("syntax_items")

  " Source the user-specified syntax highlighting file
  if exists("myscriptsfile")
    if file_readable(expand(myscriptsfile))
      execute "so " . myscriptsfile
    endif
  endif

endif


if !has("syntax_items")

  " Bourne-like shell scripts: sh ksh bash
  if getline(1) =~ '^#!.*[/\\][bk]\=a\=sh\>'
    if exists("is_bash")
      unlet is_bash
    endif
    if exists("is_kornshell")
      unlet is_kornshell
    endif
    " if bash is sh on your system as on Linux, you may prefer to
    " add the following in your .vimrc file:
    " let bash_is_sh=1
    if exists("bash_is_sh") || getline(1) =~ '^#!.*[/\\]bash\>'
      let is_bash=1
    elseif getline(1) =~ '^#!.*[/\\]ksh\>'
      let is_kornshell=1
    endif
    so <sfile>:p:h/sh.vim

  " csh and tcsh scripts
  elseif getline(1) =~ '^#!.*[/\\]t\=csh\>'
    so <sfile>:p:h/csh.vim

  " Z shell scripts
  elseif getline(1) =~ '^#!.*[/\\]zsh\>'
    so <sfile>:p:h/zsh.vim

  " ELM Mail files
  elseif getline(1) =~ '^From [a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\= .*[12][09]\d\d$'
    so <sfile>:p:h/mail.vim

  " Expect scripts
  elseif getline(1) =~ '^#!.*[/\\]expect\>'
    so <sfile>:p:h/expect.vim

  " Makefiles
  elseif getline(1) =~ '^#!.*[/\\][^/\\]*make\>'
    so <sfile>:p:h/make.vim

  " Perl
  elseif getline(1) =~ '^#!.*[/\\][^/\\]*perl[^/\\]*\>'
    so <sfile>:p:h/perl.vim

  " Vim scripts (must have '" vim' as the first line to trigger this)
  elseif getline(1) =~ '^" *[vV]im$'
    so <sfile>:p:h/vim.vim

  " Diff file:
  " - "diff" in first line (context diff)
  " - "--- " in first line and "+++ " in second line (unified diff).
  " - "*** " in first line and "--- " in second line (context diff).
  elseif getline(1) =~ '^diff\>' || (getline(1) =~ '^--- ' && getline(2) =~ '^+++ ') || (getline(1) =~ '^\*\*\* ' && getline(2) =~ '^--- ')
    so <sfile>:p:h/diff.vim

  " PostScript Files (must have %!PS as the first line, like a2ps output)
  elseif getline(1) =~ '^%![ \t]*PS'
    so <sfile>:p:h/postscr.vim

  " Awk scripts
  elseif getline(1) =~ '^#!.*awk\>'
    so <sfile>:p:h/awk.vim

  " AmigaDos scripts
  elseif $TERM == "amiga" && (getline(1) =~ "^;" || getline(1) =~ '^\.[bB][rR][aA]')
    so <sfile>:p:h/amiga.vim

  " SiCAD scripts (must have procn or procd as the first line to trigger this)
  elseif getline(1) =~ '^ *[pP][rR][oO][cC][nNdD] *$'
    source <sfile>:p:h/sicad.vim

  " Purify log files start with "****  Purify"
  elseif getline(1) =~ '^\*\*\*\*  Purify'
    source <sfile>:p:h/purifylog.vim

  endif

endif

" vim: ts=8