Browse Source

vim: Add syntax highlighting support for _list, _listx and _extra dictionary files.

master
Reece H. Dunn 9 years ago
parent
commit
bfceb9c311
4 changed files with 61 additions and 0 deletions
  1. 15
    0
      Makefile.am
  2. 3
    0
      vim/ftdetect/espeakfiletype.vim
  3. 5
    0
      vim/registry/espeak.yaml
  4. 38
    0
      vim/syntax/espeaklist.vim

+ 15
- 0
Makefile.am View File

@@ -6,6 +6,7 @@ BINDIR=@bindir@
INCDIR=@includedir@/espeak
LIBDIR=@libdir@
DATADIR=$(PREFIX)/share/espeak-data
VIMDIR=$(PREFIX)/share/vim

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = espeak-ng.pc
@@ -70,6 +71,20 @@ SUFFIXES=.html .md .ronn
.ronn.html:
ronn --html $<

##### vim:

vim_registrydir = $(VIMDIR)/registry
vim_registry_DATA = vim/registry/*.yaml
EXTRA_DIST += $(vim_registry_DATA)

vim_addons_ftdetectdir = $(VIMDIR)/addons/ftdetect
vim_addons_ftdetect_DATA = vim/ftdetect/*.vim
EXTRA_DIST += $(vim_addons_ftdetect_DATA)

vim_addons_syntaxdir = $(VIMDIR)/addons/syntax
vim_addons_syntax_DATA = vim/syntax/*.vim
EXTRA_DIST += $(vim_addons_syntax_DATA)

##### documentation:

src/espeak-ng.1: src/espeak-ng.1.ronn

+ 3
- 0
vim/ftdetect/espeakfiletype.vim View File

@@ -0,0 +1,3 @@
au BufRead,BufNewFile *_list set filetype=espeaklist fileencoding=utf-8 fileformat=unix
au BufRead,BufNewFile *_listx set filetype=espeaklist fileencoding=utf-8 fileformat=unix
au BufRead,BufNewFile *_extra set filetype=espeaklist fileencoding=utf-8 fileformat=unix

+ 5
- 0
vim/registry/espeak.yaml View File

@@ -0,0 +1,5 @@
addon: espeak
description: "allow syntax highlighting for eSpeak and eSpeak NG Text-to-Speech data files (dictionaries, etc.)"
files:
- ftdetect/espeakfiletype.vim
- syntax/espeaklist.vim

+ 38
- 0
vim/syntax/espeaklist.vim View File

@@ -0,0 +1,38 @@
" Vim syntax file
" Language: eSpeak Dictionary List Files
" Filenames: *_list, *_listx, *_extra
" Maintainer: Reece H. Dunn <[email protected]>
" Last Change: 2016 Jun 19

" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif

syn region espeaklistLineComment start="^//" end="$" keepend contains=espeaklistComment
syn match espeaklistLinePhraseEntry "^\(\(//\)\@!\)(.*$" contains=espeaklistEntryPhrase
syn match espeaklistLineEntry "^\(\(//\)\@!\)[^?(].*$" contains=espeaklistEntryWord
syn match espeaklistLineConditionalEntry "^[?!].*$" contains=espeaklistEntryConditional

syn region espeaklistComment contained start="//" end="$" keepend contains=@Spell

syn region espeaklistFlag contained start="\$" end="[ \t\r\n]" skipwhite nextgroup=espeaklistFlag,espeaklistComment

syn region espeaklistEntryConditional contained start="^[?!]" end="[ \t]" skipwhite nextgroup=espeaklistEntryPhrase,espeaklistEntryWord
syn region espeaklistEntryPhrase contained start="^(" end=")" skipwhite nextgroup=espeaklistEntryPronunciation
syn match espeaklistEntryWord contained "[^ \t\r\n]\+" skipwhite nextgroup=espeaklistEntryPronunciation,espeaklistFlag
syn match espeaklistEntryPronunciation contained "[^ \t\r\n/$!][^ \t\r\n]*" skipwhite nextgroup=espeaklistFlag,espeaklistComment

" Define the default highlighting.
" Only used when an item doesn't have highlighting yet

hi def link espeaklistComment Comment
hi def link espeaklistFlag PreProc
hi def link espeaklistEntryConditional PreProc
hi def link espeaklistEntryPhrase espeaklistEntry
hi def link espeaklistEntryWord espeaklistEntry
hi def link espeaklistEntryPronunciation None
hi def link espeaklistEntry Identifier

let b:current_syntax = "espeaklist"
" vim: ts=8

Loading…
Cancel
Save