geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

gph.vim (2309B)


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