Add Vim syntax highlighting
This commit is contained in:
20
editor-support/vim/README.md
Normal file
20
editor-support/vim/README.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Vim support for `str`
|
||||||
|
|
||||||
|
This directory provides Vim syntax highlighting and filetype detection for the `str` string manipulation language.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Manual Installation
|
||||||
|
Copy the `ftdetect` and `syntax` directories into your Vim or Neovim configuration directory.
|
||||||
|
|
||||||
|
**For Vim:**
|
||||||
|
```bash
|
||||||
|
cp -r editor-support/vim/ftdetect ~/.vim/
|
||||||
|
cp -r editor-support/vim/syntax ~/.vim/
|
||||||
|
```
|
||||||
|
|
||||||
|
**For Neovim:**
|
||||||
|
```bash
|
||||||
|
cp -r editor-support/vim/ftdetect ~/.config/nvim/
|
||||||
|
cp -r editor-support/vim/syntax ~/.config/nvim/
|
||||||
|
```
|
||||||
1
editor-support/vim/ftdetect/str.vim
Normal file
1
editor-support/vim/ftdetect/str.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
au BufRead,BufNewFile *.str,.str.rc set filetype=str
|
||||||
45
editor-support/vim/syntax/str.vim
Normal file
45
editor-support/vim/syntax/str.vim
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: str (Interactive string manipulation environment)
|
||||||
|
" Maintainer: Garrett Mills <shout@garrettmills.dev>
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Keywords (commands)
|
||||||
|
syn keyword strKeyword exit paste copy infile outfile assign clear show undo redo history edit save load runfile script
|
||||||
|
syn keyword strKeyword enclose lower upper lsub rsub prefix suffix quote unquote replace rev trim indent concat
|
||||||
|
syn keyword strKeyword line word each on drop take missing lines words split chunk join sort unique zip
|
||||||
|
syn match strKeyword "\<contains\>"
|
||||||
|
syn keyword strKeyword to from set over call lipsum
|
||||||
|
|
||||||
|
" Types
|
||||||
|
syn match strType "::\s*\zs\(string\|int\|destructured\)"
|
||||||
|
|
||||||
|
" Variables
|
||||||
|
syn match strVariable "\$\w\+"
|
||||||
|
|
||||||
|
" Operators
|
||||||
|
syn match strOperator "="
|
||||||
|
syn match strOperator ";"
|
||||||
|
syn match strOperator "::"
|
||||||
|
|
||||||
|
" Delimiters
|
||||||
|
syn match strDelimiter "[()|]"
|
||||||
|
|
||||||
|
" Strings
|
||||||
|
syn region strString start="'" end="'" skip="\\'"
|
||||||
|
|
||||||
|
" Comments
|
||||||
|
syn match strComment "--.*$"
|
||||||
|
|
||||||
|
" Default highlighting
|
||||||
|
hi def link strKeyword Keyword
|
||||||
|
hi def link strType Type
|
||||||
|
hi def link strVariable Identifier
|
||||||
|
hi def link strOperator Operator
|
||||||
|
hi def link strDelimiter Delimiter
|
||||||
|
hi def link strString String
|
||||||
|
hi def link strComment Comment
|
||||||
|
|
||||||
|
let b:current_syntax = "str"
|
||||||
Reference in New Issue
Block a user