VIM editor updated syntax files for P2 SPIN2

roglohrogloh Posts: 2,472
edited 2020-08-01 - 11:30:52 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

  • 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,396
    edited 2020-08-03 - 05:24:25
    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
  • 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
  • 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 :(
Sign In or Register to comment.