From e585c9e78f5ec3de8b54a9b7c27b58c9dd723222 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sun, 14 Oct 2018 09:35:38 +0200 Subject: [PATCH 1/6] FEATURE: Add indentation configuration Uses C Like indentation with adjusted configuration. Respects multi line values and curly braces. Does not indent within conditions so far. --- indent/typoscript.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 indent/typoscript.vim diff --git a/indent/typoscript.vim b/indent/typoscript.vim new file mode 100644 index 0000000..573a680 --- /dev/null +++ b/indent/typoscript.vim @@ -0,0 +1,21 @@ +" Vim indent file +" Language: typoscript +" Maintainer: Daniel Siepmann +" Last Change: 2018 Oct 14 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" We can use C like indentations with modified options +setlocal cindent +setlocal cinwords= +setlocal cinoptions= +" Do not indent after assignment +setlocal cinoptions+=+0 +" Indent multi line value, but not closing brace +setlocal cinoptions+=(s,m1 + +" let b:undo_indent = "setl cin<" From afd1fe384f81c899c2e328ddc6d4c0f3c1b492b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Messner?= Date: Mon, 9 Mar 2020 09:57:29 +0100 Subject: [PATCH 2/6] feat: Configure commentstring Allows to use all native supported ways. Also some plugins pick this setting up to allow easily commenting / uncommenting. --- ftplugin/typoscript.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 ftplugin/typoscript.vim diff --git a/ftplugin/typoscript.vim b/ftplugin/typoscript.vim new file mode 100644 index 0000000..9cb4ab3 --- /dev/null +++ b/ftplugin/typoscript.vim @@ -0,0 +1 @@ +setlocal commentstring=//\ %s From 2492c8b003dd870a9830ee4cb21be2c958aeb828 Mon Sep 17 00:00:00 2001 From: Stefan Szymanski Date: Sun, 6 Sep 2020 21:29:54 +0200 Subject: [PATCH 3/6] feat: Add rules for indentation --- ftplugin/typoscript.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ftplugin/typoscript.vim b/ftplugin/typoscript.vim index 9cb4ab3..488e092 100644 --- a/ftplugin/typoscript.vim +++ b/ftplugin/typoscript.vim @@ -1 +1,9 @@ -setlocal commentstring=//\ %s +setlocal commentstring=#%s + +setlocal cindent +setlocal cinwords= +setlocal cinoptions= +" Do not indent after assignment +setlocal cinoptions+=+0 +" Indent multi line value, but not closing brace +setlocal cinoptions+=(s,m1 From a76f1081591a5e1e3ec1d2c182563d8709fc40a8 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sun, 14 Oct 2018 09:48:23 +0200 Subject: [PATCH 4/6] feat: Highlight modification functions Relates #8 --- syntax/typoscript.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/syntax/typoscript.vim b/syntax/typoscript.vim index cfb4933..177677e 100644 --- a/syntax/typoscript.vim +++ b/syntax/typoscript.vim @@ -66,6 +66,15 @@ syntax case match | syntax keyword tsObjectType contained containedin=tsValue TE syntax case match | syntax keyword tsObjectType contained containedin=tsValue USER syntax case match | syntax keyword tsObjectType contained containedin=tsValue USER_INT +syntax case match | syntax keyword modificationFunction contained containedin=tsValue addToList +syntax case match | syntax keyword modificationFunction contained containedin=tsValue prependString +syntax case match | syntax keyword modificationFunction contained containedin=tsValue removeFromList +syntax case match | syntax keyword modificationFunction contained containedin=tsValue removeString +syntax case match | syntax keyword modificationFunction contained containedin=tsValue replaceString +syntax case match | syntax keyword modificationFunction contained containedin=tsValue reverseList +syntax case match | syntax keyword modificationFunction contained containedin=tsValue sortList +syntax case match | syntax keyword modificationFunction contained containedin=tsValue uniqueList + " Link groups highlight link tsComment Comment highlight link tsCondition Conditional @@ -81,6 +90,7 @@ highlight link tsTag Identifier highlight link tsTagOperator Operator highlight link tsTagAttrValue String highlight link tsObjectType Type +highlight link modificationFunction Type let b:current_syntax = "typoscript" From 246230c0eb0d01e3778461afbf9e29305dcdc86f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sun, 14 Oct 2018 09:54:35 +0200 Subject: [PATCH 5/6] feat: Highlight all operator Add := and > as tsLineOperator. Relates #8 --- syntax/typoscript.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/syntax/typoscript.vim b/syntax/typoscript.vim index 177677e..9e541c5 100644 --- a/syntax/typoscript.vim +++ b/syntax/typoscript.vim @@ -11,7 +11,7 @@ syntax region tsComment keepend start="^\s*#" end="$" syntax region tsComment keepend start="\v^\s*\/\/" end="$" syntax region tsInclude keepend start="\v^\s*\<" end="\v\>\s*$" syntax region tsCondition keepend start="\v^\s*\[" end="\]\s*$" -syntax match tsSingleline "\v^\s*\i+\s*[=<>{].*$" +syntax match tsSingleline "\v^\s*\i+\s*[=:<>{].*$" syntax region tsMultiline keepend start="\v^\s*\i+\s*\(\s*$" end="\v^\s*\)\s*$" syntax match tsDelimiter "\v^\s*\}\s*$" @@ -20,9 +20,10 @@ syntax region tsValue keepend matchgroup=tsLineOperator start="\v\=" end="\v$" c syntax region tsValue keepend matchgroup=tsDelimiter start="\v\(" end="\v^\s*\)\s*$" contained containedin=tsMultiline syntax match tsIdentifier "\v^\s*\i+" contained containedin=tsSingleline,tsMultiline syntax match tsLineOperator "\v[=<]" contained containedin=tsSymlink -syntax match tsSymlink "\v(\<|\=\s*\<)\s*\i+\s*$" contained containedin=tsSingleline +syntax match tsSymlink "\v(\<|\=\s*\<|\>\s*)\s*\i+\s*$" contained containedin=tsSingleline syntax match tsDelimiter "\v\{\s*$" contained containedin=tsSingleline -syntax match tsLineOperator "\v\>\s*$" contained containedin=tsSingleline +syntax match tsLineOperator "\v:\=" contained containedin=tsSingleline +syntax match tsLineOperator "\v\>" contained containedin=tsSingleline syntax match tsIdentifier "\v\i+\s*$" contained containedin=tsSymlink " Sub level elements From 12b2ad4a2550909874994f07c722bb823b77fd5d Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 13 Jun 2022 15:07:21 +0200 Subject: [PATCH 6/6] Remove old legacy file type extensions Those conflict with others like TypeScript anyway and should not be used anymore. typoscript and tsconfig are the official ones to use. --- ftdetect/typoscript.vim | 2 -- 1 file changed, 2 deletions(-) diff --git a/ftdetect/typoscript.vim b/ftdetect/typoscript.vim index f475123..98486f9 100644 --- a/ftdetect/typoscript.vim +++ b/ftdetect/typoscript.vim @@ -1,5 +1,3 @@ -autocmd BufNewFile,BufRead *.ts setlocal filetype=typoscript -autocmd BufNewFile,BufRead *.ts2 setlocal filetype=typoscript autocmd BufNewFile,BufRead *.typoscript setlocal filetype=typoscript autocmd BufNewFile,BufRead *.tsconfig setlocal filetype=typoscript