Add a LCP syntax highlighter for vim
Reviewers: buda, msantl, mtomic, mferencevic, ipaljak, mculinovic, vkasljevic, mpetricevic Reviewed By: msantl Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1548
This commit is contained in:
parent
da3630f8a9
commit
da9dc10373
14
tools/vim-lcp/README.md
Normal file
14
tools/vim-lcp/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# vim-lcp
|
||||
|
||||
Adds syntax highlighting of LCP files to vim. In the future the plugin may be
|
||||
extended with additional features, such as formatting, new editing commands etc.
|
||||
|
||||
## Installation
|
||||
|
||||
I'm assuming that you are using some kind of plugin manager in vim. If not,
|
||||
check out [Vundle](https://github.com/VundleVim/Vundle.vim).
|
||||
|
||||
ln -s <path-to-memgraph>/tools/vim-lcp ~/.vim/bundle/vim-lcp
|
||||
|
||||
After symlinking, edit your `vimrc` by adding a `Plugin 'vim-lcp'` directive
|
||||
inside the `call vundle#begin() ... call vundle#end()` block.
|
1
tools/vim-lcp/ftdetect/lcp.vim
Normal file
1
tools/vim-lcp/ftdetect/lcp.vim
Normal file
@ -0,0 +1 @@
|
||||
au! BufNewFile,BufRead *.lcp setfiletype lcp
|
27
tools/vim-lcp/syntax/lcp.vim
Normal file
27
tools/vim-lcp/syntax/lcp.vim
Normal file
@ -0,0 +1,27 @@
|
||||
" Quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Base LCP syntax on Lisp syntax
|
||||
runtime! syntax/lisp.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
" Include C++ syntax for inlined C++ code in LCP
|
||||
syntax include @CPP syntax/cpp.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
let b:current_syntax = "lcp"
|
||||
|
||||
" Set the inline C++ region
|
||||
syntax region lcpCPPVar matchgroup=CPPVar start="\${" excludenl end="}" contained containedin=@CPP
|
||||
highlight link CPPVar SpecialComment
|
||||
syntax region lcpCPP containedin=lispList,lispBQList,lispAtomList matchgroup=CPPBlock start="#>cpp" end="cpp<#" contains=@CPP
|
||||
highlight link CPPBlock SpecialComment
|
||||
|
||||
" Additional LCP keywords
|
||||
syntax keyword lcpKeyword contained containedin=lispAtomList,lispBQList,lispList lcp:define-class lcp:define-enum lcp:define-struct
|
||||
syntax keyword lcpKeyword contained containedin=lispAtomList,lispBQList,lispList lcp:namespace lcp:pop-namespace
|
||||
syntax keyword lcpKeyword contained containedin=lispAtomList,lispBQList,lispList lcp:capnp-namespace lcp:capnp-import lcp:capnp-type-conversion
|
||||
|
||||
highlight link lcpKeyword lispFunc
|
Loading…
Reference in New Issue
Block a user