Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
configs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
configs
Commits
dca265a4
Commit
dca265a4
authored
10 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added Latte syntax highlighting
parent
721972cb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vim/ftdetect/latte.vim
+8
-0
8 additions, 0 deletions
vim/ftdetect/latte.vim
vim/syntax/latte.vim
+127
-0
127 additions, 0 deletions
vim/syntax/latte.vim
with
135 additions
and
0 deletions
vim/ftdetect/latte.vim
0 → 100644
+
8
−
0
View file @
dca265a4
" Language: Latte Templates
" Maintainer: Martin Janiczek <martin@janiczek.cz>
" Latest Revision: 28 October 2012
" URL: http://forum.nette.org/cs/10222-latte-vim-syntax-highlighter
" URL: https://github.com/janiczek/vim-latte
autocmd
BufNewFile
,
BufRead
*
.
latte
set
filetype
=
latte
.
php
.
html
autocmd
BufNewFile
,
BufRead
*
.
phtml
set
filetype
=
latte
.
php
.
html
This diff is collapsed.
Click to expand it.
vim/syntax/latte.vim
0 → 100644
+
127
−
0
View file @
dca265a4
" Vim syntax file
" Language: Latte Templates
" Maintainer: Martin Janiczek <martin@janiczek.cz>
" Latest Revision: 11 March 2012
" URL: http://forum.nette.org/cs/10222-latte-vim-syntax-highlighter
" URL: https://github.com/janiczek/vim-latte
" ============================================================
" ================================ INCLUDES AND WHATNOT ======
" ============================================================
" check if we loaded this file before
if
exists
(
'b:current_syntax'
)
&&
b:current_syntax
==
'latte'
finish
endif
" we want to highlight PHP, HTML, CSS, JS
runtime
!
syntax
/php
.
vim
" ============================================================
" ========================================= DEFINITIONS ======
" ============================================================
" TODO: should we recognize things like => , : or not?
" TODO: more specifically, should we allow only the macros
" that really are in Latte? like:
" {link Presenter:action} <-- good
" {link} <-- bad
" TODO: is this style (#blocks same color as $phpVars) ok?
" (n:attrs different color than attrs)
" TODO: macros inside <a> links
" ------------------------------------------------------------
" ------------------------------------------- n:attribs ------
" ------------------------------------------------------------
" Commented out because it breaks highlighting of inline CSS and JS.
" TODO?
"" n:attrib: <tag n:foo="$bar">
"syn match latteAttribute contained /n:[a-zA-Z]\+\>/
"" for attributes:
"syn region htmlTag start=+<[^/]+ end=+>+
" \ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster,latteAttribute
" ------------------------------------------------------------
" ---------------------------------------------- macros ------
" ------------------------------------------------------------
" macro: {a macro}
syn
region latteMacro start
=
"{\S"
end
=
"}"
\
contains
=
latteBlockName
,
latteString
,
latteVariable
" block name: #blockName
syn
match
latteBlockName
/#[$_a-zA-Z0-9]\+\>/
contained
" string: 'abcdę'
syn
region latteString start
=+
'+ end=+'
+
contained
\
contains
=
latteVariable
syn
region latteString start
=+
"+ end=+"
+
contained
\
contains
=
latteVariable
" ------------------------------------------------------------
" -------------------------------------------- comments ------
" ------------------------------------------------------------
" comments: {* a basic comment *}
syn
region latteComment start
=
"{\*"
end
=
"\*}"
\
contains
=
latteTodo
" todo: {* TODO something *}
syn
keyword latteTodo contained TODO FIXME XXX
" ------------------------------------------------------------
" ----------------------------------------- annotations ------
" ------------------------------------------------------------
" annotation comments: {** an @annotation comment *}
syn
region latteAnnotationComment start
=
"{\*\*"
end
=
"\*}"
\
contains
=
latteTodo
,
latteAnnotation
,
latteVariable
,
latteType
" annotation: @param
syn
match
latteAnnotation
/@[$_a-zA-Z][$_a-zA-Z0-9]*\>/
contained
" variable: $myVar
syn
match
latteVariable
/$[_a-zA-Z][_a-zA-Z0-9]*\>/
contained
" type: string
syn
keyword latteType contained boolean integer float double
\
string
array object resource NULL
" ------------------------------------------------------------
" ---------------------------------------- HTML strings ------
" ------------------------------------------------------------
" (so we can highlight things inside them too ;) )
" for values:
syn
region htmlString contained start
=+
"+ end=+"
+
\
contains
=
htmlSpecialChar
,
javaScriptExpression
,
@htmlPreproc
,
latteMacro
,
latteVariable
syn
region htmlString contained start
=+
'+ end=+'
+
\
contains
=
htmlSpecialChar
,
javaScriptExpression
,
@htmlPreproc
,
latteMacro
,
latteVariable
" ============================================================
" =========================================== WIRING ;) ======
" ============================================================
" finally, use the definitions!
"hi def link latteAttribute Type
hi
def
link latteMacro PreProc
hi
def
link latteBlockName Identifier
hi
def
link latteString String
hi
def
link latteComment Comment
hi
def
link latteTodo Todo
hi
def
link latteAnnotationComment Comment
hi
def
link latteAnnotation PreProc
hi
def
link latteVariable Identifier
hi
def
link latteType Type
" prevent the file from loading again (see top)
let
b:current_syntax
=
'latte'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment