Shop OBEX P1 Docs P2 Docs Learn Events
VIM editor updated syntax files for P2 SPIN2 — Parallax Forums

VIM editor updated syntax files for P2 SPIN2

roglohrogloh Posts: 5,786
edited 2020-08-01 11:30 in Propeller 2
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.

Comments

  • RossHRossH Posts: 5,462
    Ah! Thanks, rogloh.

    VIM! The Editor of Champions! :)
  • Ahh, the other 2 users of vim :smile:
  • LOL. I'm sure there's more than just us diehards.

    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.
  • After having used vim for awhile, I find I like to keep the amount of plugins, etc to a minimum because after adding enough to it, it starts to not feel like the very lean editor it starts off as, but found this one is nice for adding indent guides:


    and this builtin for highlighting the current line:
    :set cursorline
    :hi CursorLine cterm=NONE ctermbg=8 ctermfg=white
    

    ...just to add a few niceties the PropTool and PropellerIDE have that it's missing.

    Cheers
  • avsa242 wrote: »
    Ahh, the other 2 users of vim :smile:

    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.
  • vim on the Prop - cool! Only a piece of the puzzle, of course, but would be a nice part of a self-hosted devel environment
  • ElectrodudeElectrodude Posts: 1,657
    edited 2020-08-03 05:24
    Thanks! I also made similar modifications to Andrey Demenev's P1 syntax highlighting file, but I didn't post it here because I wanted to try it for a while to make sure it was complete, and then I forgot and never posted it. I'll compare yours to mine and let you know if I find any significant differences.
  • No worries Electrodude. It should hopefully be complete now as I cut the P2 instructions names from this doc which I believe should be the latest and just grepped and verified my file included them all. There were some other aliases put in like LUTSON and LUTSOFF which might now be out of date or no longer valid for P2, not sure there.

    https://docs.google.com/spreadsheets/d/1_vJk-Ad569UMwgXTKTdfJkHYHpc1rZwxB-DcIiAZNdk/edit#gid=0
  • RossHRossH Posts: 5,462
    avsa242 wrote: »
    vim on the Prop - cool! Only a piece of the puzzle, of course, but would be a nice part of a self-hosted devel environment

    vi runs on the P2 very nicely. It is one of Catalina's Catalyst demo programs.
  • RossH wrote: »
    avsa242 wrote: »
    vim on the Prop - cool! Only a piece of the puzzle, of course, but would be a nice part of a self-hosted devel environment

    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
  • RossHRossH Posts: 5,462
    msrobots wrote: »
    RossH wrote: »
    avsa242 wrote: »
    vim on the Prop - cool! Only a piece of the puzzle, of course, but would be a nice part of a self-hosted devel environment

    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.

    I had intended to, but it is not really possible. Our satellite internet connection is just not up to the task :(
  • Francis BauerFrancis Bauer Posts: 364
    edited 2021-09-24 05:47

    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.

  • @"Francis Bauer" said:
    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.

  • @"Francis Bauer" said:

    @"Francis Bauer" said:
    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.

    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 explicit noundofile 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?

  • @Electrodude said:
    @"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 explicit noundofile 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...

  • 🙋

  • @Circuitsoft said:
    🙋

    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.

  • Francis BauerFrancis Bauer Posts: 364
    edited 2023-12-05 03:29

    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.

  • Francis BauerFrancis Bauer Posts: 364
    edited 2023-09-22 01:44

    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

Sign In or Register to comment.