From 042f21a9c6d5f616e5db53601a74559e4455caa6 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Fri, 10 Apr 2026 11:06:06 -0500 Subject: [PATCH] Add Vim syntax highlighting --- editor-support/vim/README.md | 20 +++++++++++++ editor-support/vim/ftdetect/str.vim | 1 + editor-support/vim/syntax/str.vim | 45 +++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 editor-support/vim/README.md create mode 100644 editor-support/vim/ftdetect/str.vim create mode 100644 editor-support/vim/syntax/str.vim diff --git a/editor-support/vim/README.md b/editor-support/vim/README.md new file mode 100644 index 0000000..b3584be --- /dev/null +++ b/editor-support/vim/README.md @@ -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/ +``` diff --git a/editor-support/vim/ftdetect/str.vim b/editor-support/vim/ftdetect/str.vim new file mode 100644 index 0000000..8a12aff --- /dev/null +++ b/editor-support/vim/ftdetect/str.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.str,.str.rc set filetype=str \ No newline at end of file diff --git a/editor-support/vim/syntax/str.vim b/editor-support/vim/syntax/str.vim new file mode 100644 index 0000000..0dbee6a --- /dev/null +++ b/editor-support/vim/syntax/str.vim @@ -0,0 +1,45 @@ +" Vim syntax file +" Language: str (Interactive string manipulation environment) +" Maintainer: Garrett Mills + +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 "\" +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"