newlisp.vim

Started by Cyril, November 05, 2007, 04:51:02 PM

Previous topic - Next topic

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! ;-)


"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:


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.
With newLISP you can grow your lists from the right side!

Lutz

#1
Thanks for the changes Cyril. The file has been updated here: http://newlisp.org/code/newlisp.vim.txt">http://newlisp.org/code/newlisp.vim.txt and in the next development version 9.2.4, due on the weekend.



Lutz

Cyril

#2
Quote from: "Lutz"Thanks for the changes Cyril. The file has been updated here: http://newlisp.org/code/newlisp.vim.txt">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. :-(
With newLISP you can grow your lists from the right side!

Cyril

#3
Quote from: "Cyril" 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:


  • http://wagner.pp.ru/~slobin/vim/syntax/newlisp.vim">//http://wagner.pp.ru/~slobin/vim/syntax/newlisp.vim
  • [/list]

    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, http://wagner.pp.ru/~slobin/vim/syntax/newlisp.syntax.highlighting.examples.lsp.html">here is an example of highlighted newLISP source in HTML form. I hope this will be useful to someone.
With newLISP you can grow your lists from the right side!

cormullion

#4
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.com/index.cgi?view-post-id=20070217010900">//http://unbalanced-parentheses.nfshost.com/index.cgi?view-post-id=20070217010900) - 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...

Lutz

#5
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">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.

Cyril

#6
Quote from: "Lutz"I have updated the link: http://newlisp.org/code/newlisp.vim.txt">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.


Quote from: "Lutz"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 http://www.turtle.dds.nl/newlisp/vimrc.txt">here.
With newLISP you can grow your lists from the right side!

Cyril

#7
Just in case you are lost, discussion was moved http://www.alh.net/newlisp/phpbb/viewtopic.php?p=10763">here.
With newLISP you can grow your lists from the right side!