]> git.rmz.io Git - dotfiles.git/commitdiff
vim: add qmake syntax
authorSamir Benmendil <me@rmz.io>
Thu, 27 Aug 2015 09:10:43 +0000 (10:10 +0100)
committerSamir Benmendil <me@rmz.io>
Thu, 27 Aug 2015 09:10:43 +0000 (10:10 +0100)
vim/filetype.vim
vim/syntax/qmake.vim [new file with mode: 0644]

index 9dfce86d9ec7372580cbce1f5f86efd3279375ed..47117e712b13d789f28f53071a6b34695f4a4d3c 100644 (file)
@@ -1,8 +1,10 @@
 if exists("did_load_filetypes")
     finish
 endif
+
 augroup filetypedetect
-    autocmd! BufNewFile,BufRead PKGBUILD setfiletype PKGBUILD
+    autocmd! BufNewFile,BufRead PKGBUILD    setfiletype PKGBUILD
+    autocmd! BufRead,BufNewFile *.pro,*.pri setfiletype qmake
 augroup END
 
 augroup ft_ros
diff --git a/vim/syntax/qmake.vim b/vim/syntax/qmake.vim
new file mode 100644 (file)
index 0000000..f22399f
--- /dev/null
@@ -0,0 +1,49 @@
+" qmake project syntax file
+" Language:     qmake project
+" Maintainer:   Arto Jonsson <ajonsson@kapsi.fi>
+" https://github.com/artoj/qmake-syntax-vim/
+
+if exists("b:current_syntax")
+    finish
+endif
+
+syntax case match
+
+" Comment
+syn match qmakeComment "#.*"
+
+" Variables
+syn match qmakeVariable /[A-Z_]\+\s*=/he=e-1
+syn match qmakeVariable /[A-Z_]\+\s*\(+\|-\||\|*\|\~\)=/he=e-2
+
+" Value of a variable
+syn match qmakeValue /$$[A-Z_]\+/
+syn match qmakeValue /$${[A-Z_]\+}/
+
+" Environment variable
+syn match qmakeEnvVariable /$([A-Z_]\+)/
+syn match qmakeEnvVariable /$$([A-Z_]\+)/
+
+" Qt build configuration
+syn match qmakeQtConfiguration /$$\[[A-Z_]\+\]/
+
+" Builtins
+" + contains
+" + CONFIG
+syn keyword qmakeBuiltin basename count dirname error exists
+syn keyword qmakeBuiltin find for include infile isEmpty join member message
+syn keyword qmakeBuiltin prompt quote sprintf system unique warning
+
+" Scopes
+syn match qmakeScope /[0-9A-Za-z_-]\+\(|\|:\)/he=e-1
+syn match qmakeScope /[0-9A-Za-z_-]\+\s*{/he=e-1
+
+hi def link qmakeComment Comment
+hi def link qmakeVariable Identifier
+hi def link qmakeBuiltin Function
+hi def link qmakeValue PreProc
+hi def link qmakeEnvVariable PreProc
+hi def link qmakeQtConfiguration PreProc
+hi def link qmakeScope Conditional
+
+let b:current_syntax = "qmake"