dc.vim : syntax definitions for dc (desktop calculator)
| script karma
Downloaded by 299
Comments, bugs, improvements
script versions (upload new version)
|Syntax definitions file for dc (desktop calculator).
Catch a glimpse of it at http://brhefele.brainaxle.com/misc/dc.html - note this html file was generated using vim's export highlighted as html tool.
Important note: this was written to support the way I code dc. The big problem with highlighting dc (IMO) is that of macros. Macros are stored in strings, with no clear way to delineate what a string may or may not be used for later on. Or, at least, no prescribed way. So, I need to prescribe my own way. Basically, everything inside […] is interpreted as a string, unless the string is followed by an execute command (x) OR a save command and a newline (s.\n). This allows me to use macros as functions, and for the sake of tidiness, I keep all functions on their own lines. I assume, then, that a […]sx in the middle of the line is just a string being saved for later. I make a lot of assumptions. And I may change this later to allow for some variables to be set depending on a user's usage. For instance, I also set load/save register operations to a specific highlight. But if you load a register to execute, including as part of a conditional, the whole operation changes to a different highlight (that for execute).
So again, this won't work for everyone. It might not work for anyone except me, really, since who uses dc these days anyway? But if you have any issues, suggestions, I welcome any and all emails on the subject.
|Drop dc.vim into ~/.vim/syntax
Either set the filetype manually (:setf dc) or add
au! BufRead,BufNewFile *.dc setfiletype dc
Click on the package to download.
ip used for rating: