newlisp.vim 1.31

Notices and updates
Locked
Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

newlisp.vim 1.31

Post by Cyril »

New release of newlisp.vim syntax highlighter.

* Multiple patches (mostly new function names) by Lutz are included,

* Some typos introduced by Lutz are removed, ;-)

* Minor code cleanup.

This release is numbered 1.31, because 1.28 to 1.30 was used by Lutz. I believe it is ready for newlisp v10.3. Downloadable from the usual locations (one, two).
With newLISP you can grow your lists from the right side!

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: newlisp.vim 1.31

Post by Lutz »

Thanks Cyril for keeping newlisp.vim always in good shape.

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: newlisp.vim 1.31

Post by TedWalther »

Cyril, is there any chance to doll up the string hilighting?

I notice that curly braces {} and [text][/text] blocks aren't highlighted as strings. And if a quote " char is inside {} like {}, it treats the " as the start of a string, which can be annoying. Take the following code for instance:

(println {"} (+ 1 2 3) " hi there!")
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

Re: newlisp.vim 1.31

Post by Cyril »

TedWalther wrote:I notice that curly braces {} and [text][/text] blocks aren't highlighted as strings. And if a quote " char is inside {} like {}, it treats the " as the start of a string, which can be annoying.
It does handle strings, including [text]...[/text] and {braces {even nested}}, see example here. And I've checked your example just now (on Windows and on Debian, to be sure), it works well too. Are you sure your Vim has started newlisp.vim highlighter and not some other (e.g. Common Lisp from Vim distribution?). Starting a wrong highlighter is the most common source of such errors. What the command

Code: Select all

:set syntax?
says? It should be "newlisp", not "lisp" (the latter is Common Lisp). To start newlisp highlighter on .lsp files automatically, you should put newlisp.vim in the right place of your file system, and add the following into your .vimrc:

Code: Select all

autocmd! filetypedetect BufNewFile,BufRead *.lsp set filetype=newlisp
Hope this helps.
With newLISP you can grow your lists from the right side!

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: newlisp.vim 1.31

Post by TedWalther »

Thank you. I note the following files in my Ubuntu install of vim:
/usr/share/vim/vim72/ftplugin/lisp.vim
/usr/share/vim/vim72/indent/lisp.vim
/usr/share/vim/vim72/syntax/lisp.vim
So where should I copy newlisp.vim to? The syntax directory? The indent directory? To all three directories? If only to the syntax, should I copy indent/lisp.vim over to indent/newlisp.vim?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

Re: newlisp.vim 1.31

Post by Cyril »

The Vim logic of plugin search is a bit complex. The general answer is "the syntax subdirectory of any of the directories listed in 'runtimepath' option". But this is usually a very long list, so the short answer is: /usr/share/vim/vimfiles/syntax for system-wide settings, or ~/.vim/syntax for your personal ones. /usr/share/vim/vim72/syntax will also work, but I believe that /vim72/ directory is intended to be used for standard vim plugins, and /vimfiles/ for third-party ones.

Hmm... I've just browsed the Debian Packaging Policy for Vim, and it claims that the right directory is /usr/share/vim/addons/syntax. You see, all three system-wide locations will in fact work the same, the difference is only in keeping your Debian (or Ubuntu) system in the sane state. Matter of policy, that is.

And as for other question: my newlisp.vim is syntax file only, it has nothing to do with indent or ftplugin. I just don't feel like a need for special indentation mode for newlisp, so I didn't care. You can experiment with either copying standard lisp files from indent and ftplugin directories, or just not using any lisp-specific indent mode. I am quite happy with the later option. ;-)
With newLISP you can grow your lists from the right side!

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: newlisp.vim 1.31

Post by Lutz »

This is what you also can do: in my /Users/lutz/.vimrc file. At the end, I have the following 2 lines:

Code: Select all

au BufRead,BufNewFile *.lsp set filetype=newlisp
au! Syntax newlisp source /Users/lutz/etc/newlisp.vim
… and then I put newlisp.vim in /Users/lutz/etc/newlisp.vim. This is on Mac OS X and of course this works only for one user and not system wide like Cyril's solution would work. If this is part of the Debian newLISP installation, then the system wide solution may be the better.

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: newlisp.vim 1.31

Post by TedWalther »

The newlisp package can't assume vim is installed. Rather than split out newlisp.vim into a separate debian package, it would be nicer to get it folded upstream. Is that a possibility?

For now, Lutz, your method looks like the best one. Maybe I should document it in the README.Debian.

For even more robust file matching, is there a way in vim to tell it that a file that begins with #!-blahblahblah-/newlisp is a newlisp file?

Ted
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: newlisp.vim 1.31

Post by TedWalther »

Here is my current .vimrc:
autocmd! filetypedetect BufNewFile,BufRead *.lsp set filetype=newlisp autoindent lisp lispwords=define,define-macro,set,setf,setq,lambda,lambda-macro,fn,if,if-not,when,unless,case,begin,let,letex,letn,doargs,dolist,dotimes,dostring,while,until,do-while,do-until
autocmd! Syntax newlisp source /usr/share/newlisp-10.2.7/util/newlisp.vim
It does someone correct indenting of the code, but it doesn't yet equal the nicety of GNU Emacs indenting for lisp. In emacs, you can tell it how many "significant" arguments should be given extra indentation, before reverting to the regular indentation. For instance, a "while" symbol, if you hit Enter, the expression to be evaluated should get extra indentation, then the body of the while loop should only have regular indentation.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: newlisp.vim 1.31

Post by TedWalther »

I was putting together a HOWTO to properly integrate newlisp with vim, and ran into a snag. vim already hardwires .lsp files to a lisp syntax hilighter; therefore a .lsp file doesn't fall through to the code that grovels through the file itself and sees the #!/usr/bin/newlisp line. I can edit files without the .lsp suffix and syntax hilighting works just fine. I could patch this, but I'm not sure how to do it in a way that lets newlisp syntax hilighting coexist with Common Lisp syntax hilighting.

The relevant file is /usr/share/vim/vim72/filetype.vim.

Oh, wait, the ftdetect/ subdirectory might be relevant to override the erroneous detection of .lsp files. More on this tomorrow.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

Tim Johnson
Posts: 253
Joined: Thu Oct 07, 2004 7:21 pm
Location: Palmer Alaska USA

Re: newlisp.vim 1.31

Post by Tim Johnson »

I have the following

Code: Select all

" .vimrc
autocmd BufNewFile,BufRead *.lsp set filetype=newlisp
autocmd BufRead,BufNewFile *.lsp setlocal shiftwidth=2 tabstop=2 
I put newlisp.vim in my ~/.vim/syntax directory
I also put my own auxiliary newlisp.vim in ~/.vim/after/syntax
In there I put stuff like highlighting for my own user-defined "standard library"

I have not had to tweak filetype.vim at all.

On my slackware system, since I have installed vim via compilation filetype.vim is at
/usr/local/share/vim/vim72.

BTW: I only use vim for ad hoc editing (launched from MC). I primarily use emacs
with the newlisp mode that I wrote for it several years ago. I don't care for emacs
default indentation schema, so I modified that.
Programmer since 1987. Unix environment.

Locked