Hi Jean-Joseph,
No problem! I didn’t mention on the mailing list that I was going to write one
anyway :) And having your version to compare with is pretty useful too. Also,
the version I’m currently writing is going to be slower than yours (in terms of
opening a *.fdf file). With my test version, containing little more than 500
fdf-keywords, opening a file already takes a couple of tenths of a second. It’s
not a lot, but enough to notice when quickly opening files, eg. for debugging
purposes.
This slow behaviour is due to the fact that Siesta ignores dots, underscores,
and dashes in fdf-keywords. In other words:
LatticeConstant
Lattice.Constant
Latt_iceConstant
L..at--ticeCons_ta_nt
Are all understood by Siesta. vim doesn’t have a simple way to ignore a list of
characters in keywords, so the way to go is to first define a function which
takes a string as input, and writes the suitable regex - in vim’s language,
that is [\._-]* between every char of the string. Something like:
func! CP(word)
let l:s = ''
let l:first = 1
for i in range(len(a:word))
if !l:first
let l:s .= '[\._-]*'
else
let l:first = 0
endif
let l:s .= a:word[i]
endfor
return l:s
endf
And then to use that function on each of the Siesta keyword you want to
include, using the exe function (which allows the use of functions in
functions):
exe 'syn match siestaKeys /\<'.CP('LatticeConstant').'\>/‘
So in the end, it’s pretty cumbersome.. but it works!
Arthur
> On 14 Apr 2016, at 17:06, Jean-Joseph Adjizian
> wrote:
>
> Hello Arthur,
>
> Sorry about the email earlier. I was not sure if you were going to write it
> when I first started writing it today.
> However since I have now done quite a fait bit I thought I would still share
> it with you. If it is helpful to you that s good, otherwise just throw it to
> the bin ;-)
> Attached here is an update of the old one I emailed earlier. The new vim
> syntax file have all parameters included for both codes, is not case
> sensitive anymore and does not mind dots anymore.
> The color scheme is as: Green for "string" inputs, Purple for boolean/logical
> inputs , blue for block inputs, red for numbers and yellow for units.
>
> Cheers!
>
> JJ
>
> Le 14/04/16 13:05, Jean-Joseph Adjizian a écrit :
>> Hi Arthur,
>>
>> Thanks for the tip. It works just fine now.
>>
>> Jean-Joseph
>>
>> Le 14/04/16 12:50, Arthur France-Lanord a écrit :
>>> you can just add “syn case ignore”.
>>>
>>>
>>>
On 14 Apr 2016, at 11:37, Jean-Joseph Adjizian
wrote:
>>> .
>>>
>>
>> .
>>
>
>