Page 1 of 1

newlisp.vim

Posted: Tue Nov 06, 2007 12:51 am
by Cyril
While editing my newlisp script in Vim, I have noted that standard predicates are not highlighted as keywords. Brief investigation shows that "?" symbol is not listed among valid keyword characters (and Vim highlights a word as a keyword only if it is listed among keywords and it consists of keyword characters only). Looking deeper in the code, I noted also that neither of "!$%&" are listed as keyword characters. This means that atoms containing these symbols will be not treated as words by word movement commands. And, BTW, variables $0, $1 etc. was not highlighted too. So I added these five characters to the keywords characters list, and life immediately became bright and shiny! ;-)

Code: Select all

"before:
setlocal iskeyword=42,43,45,47-58,60-62,64-90,97-122,_

"after:
setlocal iskeyword=33,36-38,42,43,45,47-58,60-90,97-122,_
Update: Investigating further -- also "\^|~" was missed. Updated version:

Code: Select all

setlocal iskeyword=33,36-38,42,43,45,47-58,60-90,92,94-122,124,126,_
P.S. I use newlisp.vim 1.0.52 from Contributed Code page.

Posted: Tue Nov 06, 2007 12:09 pm
by Lutz
Thanks for the changes Cyril. The file has been updated here: http://newlisp.org/code/newlisp.vim.txt and in the next development version 9.2.4, due on the weekend.

Lutz

Posted: Tue Nov 06, 2007 5:10 pm
by Cyril
Lutz wrote:Thanks for the changes Cyril. The file has been updated here: http://newlisp.org/code/newlisp.vim.txt and in the next development version 9.2.4, due on the weekend.
Alas thing appears more complicated than looked. In particular, true and nil aren't highlighted. I am going to investigate on this, but this is not an on-line hack, I need to explore the code in depth. Therefore I don't promise to complete the task before release. :-(

Posted: Wed Nov 07, 2007 6:20 am
by Cyril
Cyril wrote: I am going to investigate on this, but this is not an on-line hack, I need to explore the code in depth. Therefore I don't promise to complete the task before release. :-(
And now is the time for some good news. I've failed in despair to grok the official syntax file (it is too much based on Common Lisp, and these two languages have quite different morphologies). Therefore I've decided to write my own syntax file, and spent a sleepless night (in eastern hemisphere) on this task. So at this cool morning I have a brand new Vim syntax file for newLISP language, written from scratch and not based on any previous sources. Look at it here:
There are two screenfuls of comments at the top of the file, explaining some hard decisions I have made while hacking it. And if you want to try before buy, here is an example of highlighted newLISP source in HTML form. I hope this will be useful to someone.

Posted: Wed Nov 07, 2007 6:54 pm
by cormullion
Nice job.

I don't use Vim, but I have previously thought about using the Vim syntax colouring for my Introduction to newLISP (http://unbalanced-parentheses.nfshost.c ... 0217010900) - it's possible to plug in a vim-based module so that the code gets coloured when the document is rendered to PDF.

I'll get round to it one day...

Posted: Wed Nov 07, 2007 7:43 pm
by Lutz
Excellent work!

Special thanks for all the error flagging you have put in. I have updated the link: http://newlisp.org/code/newlisp.vim.txt and the file will be included in the coming development version 9.2.5 (with your permission).

Lutz

ps: I also included a link to your .vimrc file, the other .vimrc will be redone at a later time.

Posted: Fri Nov 09, 2007 6:18 am
by Cyril
Lutz wrote:I have updated the link: http://newlisp.org/code/newlisp.vim.txt and the file will be included in the coming development version 9.2.5 (with your permission).
I'll be glad if you'll do this. I was always confused that a fair usage of such a short works (150 lines or so) need some formal approving. In my previous short pieces of code I used to write "Public Domain", but I was told recently that there is no legal "Public Domain" concept in some countries, in particular in Russia. Therefore I don't know the right legal spell, so I just say in a plain (or rather broken) English -- use it as you wish!

In fact I have a plan for the 1.2 version (with some improvements), but I can't promise any release date now. In particular, I don't know whether it will be done before 9.2.5.
Lutz wrote:ps: I also included a link to your .vimrc file, the other .vimrc will be redone at a later time.
My .vimrc contains some clever ideas (I hope), but it is totally unrelated to newLISP. I rather not suggest for a newbee to just copy it. Probably Peter's .vimrc will be more useful -- it contains some really neat newLISP-specific tricks. It is located here.

Posted: Sat Nov 10, 2007 8:48 am
by Cyril
Just in case you are lost, discussion was moved here.