VIM editor updated syntax files for P2 SPIN2
rogloh
Posts: 5,837
Hi, for those people who use VIM as their source editor, I have updated the VIM syntax files that were created by Andrey Demenev some time back for P1 Spin and they should now support P2 syntax highlighting instead as well as the ## option, for recognized .spin2 file types.
If I didn't miss anything this should now hopefully cover all the PASM2 mnemonics and SPIN2 reserved words. It currently doesn't cover all those new names Chip has added for streamer modes, smartpin modes and events though those could be added in time if anyone wants to do that. (It was tedious enough to do all the SPIN2 PASM2 names so I didn't go further there).
Copy these two spin2.vim files into your .vim/syntax and .vim/ftdetect folders accordingly. The directory structure in the ZIP file should help figure out where they go.
If I didn't miss anything this should now hopefully cover all the PASM2 mnemonics and SPIN2 reserved words. It currently doesn't cover all those new names Chip has added for streamer modes, smartpin modes and events though those could be added in time if anyone wants to do that. (It was tedious enough to do all the SPIN2 PASM2 names so I didn't go further there).
Copy these two spin2.vim files into your .vim/syntax and .vim/ftdetect folders accordingly. The directory structure in the ZIP file should help figure out where they go.
Comments
VIM! The Editor of Champions!
After checking the latest documentation I found a couple of missing names and have updated the ZIP file in the first post with the fixes.
Changes:
-added CASE_FAST, GETSCP, QMUL, QROTATE
-ROUND/TRUNC/FLOAT were being used as types, changed these to reserved words
-reordered the SPIN2 reserved words alphabetically
-typos & duplicates fixed
For now I've kept in TRUE/FALSE/PI names from P1 SPIN as I imagine they will get defined for P2 at some point. We might eventually like POSX & NEGX defined too if they make it over to P2.
and this builtin for highlighting the current line:
...just to add a few niceties the PropTool and PropellerIDE have that it's missing.
Cheers
I use vim, but only in the vi mode. I may have used the arrow keys a few times, and maybe used the mouse for cursor positioning once. I wrote a vi editor that runs on the P1. Someday I'll port it to the P2 and maybe add a few vim features.
https://docs.google.com/spreadsheets/d/1_vJk-Ad569UMwgXTKTdfJkHYHpc1rZwxB-DcIiAZNdk/edit#gid=0
vi runs on the P2 very nicely. It is one of Catalina's Catalyst demo programs.
You should do a demo of Catalina and friends as a Zoom Meeting.
Enjoy!
Mike
I had intended to, but it is not really possible. Our satellite internet connection is just not up to the task
Starting with Andrey Demenev's (2009 Dec 2013) original _spin.vim syntax file, I created an updated version for Spin2/PASM2.
Using the current Spin2 symbol table provided by Chip, I added all the known Spin2/PASM2 keywords and organized them in the _spin2.vim file. I've been using these file(s) for awhile and they appear to look OK to me, of course everyone is different. Feel free to change the various color definitions to what works for you.
Read the "00_README_FIRST.txt" in the attached package for installation/usage details.
If you are a vim/gvim user (there are a few of us left), give these file(s) a try and let me know if there is anything missing or if you have additional improvements. I will continue to update the file(s) as needed if any changes occur to the Spin2/PASM2 set of keywords.
September 23, 2021: I've updated the package/files for the addition of the new Spin2 Floating Point commands.
Bumped this thread to make it visible again: See Comment #13 for the updated zip package.
February 16, 2022: I've updated the following package/files for the addition of the new Spin2 BYTEFIT, WORDFIT, @"Text" commands.
@"Francis Bauer" I also have my own Vim PASM 2 syntax file based on Andrey Demenev's Spin 1 syntax file, but I wrote it before Spin2 was usable, so the Spin parts are still pretty much just Spin 1. I started merging my version with yours (the result is ending up being mostly yours by volume). I have a lot of suggestions to make, and it'd be easier to be able to just send you a pull request with all of the changes rather than posting lots of changes here for you to manually make.
(Better yet, someone should make a Git repository collecting all Parallax-related Vim stuff together in a single Vim plugin. I suppose I could do this if anyone shows up with some content to give me besides Spin and Spin 2 highlighting. It'd be nice if it could be an official Parallax repo, I guess.)
I looked inside your
.vimrc
to see if you had anything Spin-specific in there, and I noticed you have an explicitnoundofile
in your.vimrc
. That seems really strange to me - infinite persistent undo is one of my favorite features of Vim. What made you turn it off?A Git repository would be useful, but I don't know if there really are that many people using Vim in relation to P1 or P2 programming. I wouldn't be surprised if there was only as many that could fit in a nibble (4bits) without overflowing...
There are probably a lot more people using Stephen M Moraco's Visual Studio environment than Vim for working with the P2.
I would like to see your suggestions, though. If you want you could send them to me directly using the Forum's mail/notes feature.
I have been using Vim (aka vi,ex) since my UNIX days at HP since 1987, so I gravitate to it whenever I have to work with text.
I've been doing most of my P2 programming in either PropTool or PNut, but I use Vim when needing to do extensive content manipulation, plus is helps to have multiple windows open showing the contents of various files.
I typically have the
noundofile
setting set, since I bounce around between a lot of text file projects for all kinds of things and I don't want to have to keep cleaning-up all the .un files that accumulate. If I'm working on something major that I do want to keep a longer history of changes, I clear the setting for that project/work session.Anyway, I'm glad to hear from another Vim (vi) user, there probably aren't that many of us left in world...
🙋
My eyesight must be going, I had to copy the above emoji into Word and enlarge it to see what it was. Are you raising your hand to ask a question?
Count me among vi users. Trying to learn neovim now.
Starting with Andrey Demenev's (2009 Dec 2013) original _spin.vim syntax file, I created an updated version for Spin2/PASM2.
Using the current Spin2 symbol table provided by Chip, I added all the known Spin2/PASM2 keywords and organized them in the _spin2.vim file. I've been using these file(s) for awhile and they appear to look OK to me, of course everyone is different. Feel free to change the various color definitions to what works for you.
Read the "00_README_FIRST.txt" in the attached package for installation/usage details.
If you are a vim/gvim user (there are a few of us left), give these file(s) a try and let me know if there is anything missing or if you have additional improvements. I will continue to update the file(s) as needed if any changes occur to the Spin2/PASM2 set of keywords.
September 23, 2022: I've updated the package/files for the addition of the DOWNLOAD_BAUD command and added additional DEBUG commands.
November 28, 2022: I've updated the package/files for the addition of the FIELD command and added additional changes found in the PNut V37 release.
September, 2023: I've updated the package/files for the addition of the repeat WITH command in the PNut V40 release.
December, 2023: I've updated the package/files for the addition of the BYTES(), WORDS(), LONGS() and LSTRING() commands in the PNut V42 release.
Updated gvim SPIN2 zip package (see post #21) for latest changes to SPIN2 found in PNut V37
Updated gvim SPIN2 zip package (see post #21) for latest changes to SPIN2 found in PNut V40
Updated gvim SPIN2 zip package (see post #21) for latest changes to SPIN2 found in PNut V42