nvim-config

Log | Files | Refs | Submodules | README

gph.vim (2295B)


      1 " Last Change: 2020 Dec 07
      2 " Syntax colouring for gopher .gph files used by geomyidae
      3 " Muddled about a bit by dive @ freenode / #gopherproject
      4 " 2017-11-15
      5 
      6 set shiftwidth=4
      7 set tabstop=4
      8 set noexpandtab
      9 
     10 if version < 600
     11   syntax clear
     12 elseif exists("b:current_syntax")
     13   finish
     14 endif
     15 
     16 hi def link gopherComment           Comment
     17 hi def link gopherType              Preproc
     18 hi def link gopherURL               Statement
     19 hi def link gopherHtml              Statement
     20 hi def link gopherLink              Statement
     21 hi def link gopherServerPort        Keyword
     22 hi def link gopherBracket           Preproc
     23 hi def link gopherPipe              Preproc
     24 hi def link gopherCGI               Type
     25 hi def link gopherCGI2              Type
     26 hi def link gopherQuery             Type
     27 hi def link gopherErr               Error
     28 hi def link SynError                Error
     29 
     30 " Format of lines:
     31 "   [<type>|<desc>|<path>|<host>|<port>]
     32 
     33 "<desc> = description of gopher item. Most printable characters should work.
     34 "
     35 "<path> = full path to gopher item (base value is "/" ). Use the "Err" path for
     36 "items not intended to be served.
     37 "
     38 "<host> = hostname or IP hosting the gopher item. Must be resolvable for the
     39 "intended clients. If this is set to "server" , the server's hostname is used.
     40 "
     41 "<port> = TCP port number (usually 70) If this is set to "port" , the default
     42 "port of the server is used.
     43 
     44 " Comments
     45 syn region  gopherComment   start="<!--"   end="-->"
     46 
     47 " URLs
     48 syn match   gopherURL   "http:"
     49 syn region  gopherLink  start="http:"lc=5 end="|"me=e-1
     50 syn match   gopherURL   "gopher:"
     51 syn match   gopherURL   "URL:"
     52 syn match   gopherURL   "URI:"
     53 syn region  gopherLink  start="gopher:"lc=7 end="|"me=e-1
     54 
     55 " Pipes
     56 syn match gopherPipe "|" containedin=gopherServerPort
     57 
     58 " Queries and CGI
     59 syn match gopherQuery "^\[7"lc=1
     60 syn match gopherCGI "|[^|]*\.cgi[^|]*"lc=1
     61 syn match gopherCGI2 "|[^|]*\.dcgi[^|]*"lc=1
     62 
     63 " Server|Port
     64 syn match gopherServerPort "|[^|]*|[^|]*]"
     65 
     66 " Start and end brackets
     67 match gopherBracket "[\[\]]"
     68 
     69 " Entity
     70 syn region  gopherType  start="^\[[0123456789ghHmswITi\+:;<PcMd\*\.]"lc=1 end="|" oneline
     71 
     72 " HTML and networking
     73 syn match gopherHtml "^\[[hHw8]"lc=1
     74 
     75 " Text comments beginning with 't'
     76 syn match gopherComment "^t"
     77 
     78 " Err
     79 syn match gopherErr "Err"
     80 syn match gopherErr "^\[3"lc=1