Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
configs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
configs
Commits
dca265a4
Commit
dca265a4
authored
Jan 05, 2015
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Latte syntax highlighting
parent
721972cb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
0 deletions
+135
-0
vim/ftdetect/latte.vim
vim/ftdetect/latte.vim
+8
-0
vim/syntax/latte.vim
vim/syntax/latte.vim
+127
-0
No files found.
vim/ftdetect/latte.vim
0 → 100644
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
vim/syntax/latte.vim
0 → 100644
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'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment