From 71dca6a35815f5cb0f5bbe450cf35d9c256fe437 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 21 Nov 2023 15:05:12 -0800 Subject: [PATCH] initial implementation --- CHANGELOG.md | 16 +++++++++++++++ README.md | 16 +++++++++++++++ tokipona.vim | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 README.md create mode 100644 tokipona.vim diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..24992d8 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [1.0.0] - 2023-11-21 + +### Added + +* Initial implementation + + +[1.0.0]: https://github.com/alxndr/vim-syntax-tokipona/releases/tag/v1.0.0 diff --git a/README.md b/README.md new file mode 100644 index 0000000..a01f109 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# `vim-syntax-tokipona` + +Define [vim] `syntax` and `highlight` settings for text written in [toki pona]. + + +## Usage + +`:set filetype=tokipona` + + +## Screenshot + +[![screenshot](https://i.imgur.com/TfkF8ztl.png){:style="max-width:320px"}](https://i.imgur.com/TfkF8zt.png) + +[toki pona]: https://tokipona.org +[vim]: https://www.vim.org/ diff --git a/tokipona.vim b/tokipona.vim new file mode 100644 index 0000000..abeab53 --- /dev/null +++ b/tokipona.vim @@ -0,0 +1,57 @@ +" Vim syntax file +" Language: Toki Pona (unofficial) +" Maintainer: jan Lesate +" Source: https://github.com/alxndr/vim-syntax-tokipona + +let b:current_syntax = "tokipona" + +" ... first define the most general things +syntax match tpWord '[A-Za-z]\+' +syntax match tpPhraseEndingPunctuation '[.:!?…]\+' +syntax match tpNonLetters '[^A-Za-z]\+' + +" ... then define regions +syntax region tpPrenex matchgroup=tpPrenex start=/^/ start=/[\.:!\?…]/ end=/\/ contains=ALLBUT,tpPrenex,tpPhraseEndingPunctuation keepend +syntax keyword tpPrenexSuffix la contained + +" ... then match arbitrary headnouns + names +syntax match tpNamesMatch '\<[a-z]\+\s\+\(\<[A-Z][A-Za-z]\+\>\s*\)\+' " broken?? + +" ... then define more specific terms +syntax keyword tpInterrogatives anu seme +syntax match tpInterrogativesMatch '\<\([a-z]\+\) ala \1\>' +syntax keyword tpNounParticles en pi +syntax keyword tpModifiers kin taso +syntax keyword tpPrepositions kama ken kepeken lon sama tan tawa +syntax keyword tpPronouns mi ni ona sina +syntax keyword tpQuantifier ala ale ali +syntax keyword tpVerbParticles e li +syntax keyword tpVocalizations a o + +" highlight tpNonLetters gui=bold + +highlight tpPrenex gui=italic +highlight tpPrenexSuffix gui=italic + +highlight default link tpNamesMatch Function +highlight default link tpPronouns Statement +highlight default link tpNounParticles Type + +highlight default link tpInterrogatives Special +highlight default link tpInterrogativesMatch Special +highlight default link tpQuantifier Type + +highlight default link tpPrepositions Type +highlight default link tpNonLetters Comment + +highlight default link tpVerbParticles Constant +highlight default link tpModifiers String + +highlight tpVocalizations gui=underline + +" Comment is gray italic +" Constant is orange +" Identifier is red +" Type is yellowish +" Statement is purply +" Function is blue