sponsor Vim development Vim logo Vim Book Ad

dc.vim : syntax definitions for dc (desktop calculator)

 script karma  Rating 5/2, Downloaded by 299    Comments, bugs, improvements  Vim wiki

created by
brian hefele
 
script type
syntax
 
description
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.
 
install details
Drop dc.vim into ~/.vim/syntax
Either set the filetype manually (:setf dc) or add

au! BufRead,BufNewFile *.dc  setfiletype dc

to filetype.vim.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
dc.vim 1.0 2010-05-04 6.0 brian hefele Initial upload
ip used for rating: 54.81.71.187

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo