Skip to content

Commit

Permalink
Merge pull request #78 from gekkowrld/vi
Browse files Browse the repository at this point in the history
Add vim syntax highlighting
  • Loading branch information
AvicennaJr committed Jun 9, 2024
2 parents 9c317d5 + db8033a commit 170d37b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
14 changes: 13 additions & 1 deletion extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@

## [VSCODE](./vscode/)

Nuru syntax highlighting on VSCode
Nuru syntax highlighting on VSCode

## [VIM](./vim)

The file contained herein has a basic syntax highlight for vim.
The file should be saved in `$HOME/.vim/syntax/nuru.vim`.
You should add the following line to your `.vimrc` or the appropriate location:

```vim
au BufRead,BufNewFile *.nr set filetype=nuru
```

Only basic syntax highlighting is provided by the script.
51 changes: 51 additions & 0 deletions extensions/vim/syntax/nuru.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
" Sintaksia ya nuru kwenye programu ya "vim"
" Lugha: Nuru

" Maneno tengwa
syntax keyword nuruKeyword unda pakeji rudisha vunja endelea tupu
syntax keyword nuruType fanya
syntax keyword nuruBool kweli sikweli
syntax keyword nuruConditional kama sivyo au
syntax match nuruComparision /[!\|<>]/
syntax keyword nuruLoop ktk while badili
syntax keyword nuruLabel ikiwa kawaida

" Nambari
syntax match nuruInt '[+-]\d\+' contained display
syntax match nuruFloat '[+-]\d+\.\d*' contained display

" Viendeshaji
syntax match nuruAssignment '='
syntax match nuruLogicalOP /[\&!|]/

" Vitendakazi
syntax keyword nuruFunction andika aina jaza fungua

" Tungo
syntax region nuruString start=/"/ skip=/\\"/ end=/"/
syntax region nuruString start=/'/ skip=/\\'/ end=/'/

" Maoni
syntax match nuruComment "//.*"
syntax region nuruComment start="/\*" end="\*/"

" Fafanua sintaksia
let b:current_syntax = "nuru"

highlight def link nuruComment Comment
highlight def link nuruBool Boolean
highlight def link nuruFunction Function
highlight def link nuruComparision Conditional
highlight def link nuruConditional Conditional
highlight def link nuruKeyword Keyword
highlight def link nuruString String
highlight def link nuruVariable Identifier
highlight def link nuruLoop Repeat
highlight def link nuruInt Number
highlight def link nuruFloat Float
highlight def link nuruAssignment Operator
highlight def link nuruLogicalOP Operator
highlight def link nuruAriOP Operator
highlight def link nuruType Type
highlight def link nuruLabel Label

0 comments on commit 170d37b

Please sign in to comment.