Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr committed Nov 21, 2023
1 parent 16507bf commit 71dca6a
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/
57 changes: 57 additions & 0 deletions tokipona.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
" Vim syntax file
" Language: Toki Pona (unofficial) <https://tokipona.org>
" Maintainer: jan Lesate <alxndr+tp.vim@gmail.com>
" 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=/\<la\>/ 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

0 comments on commit 71dca6a

Please sign in to comment.