Samuel Ferencik wrote:
Hi,

DCL is a scripting language for OpenVMS, whose lines of code must all start with a $.

Here is a code excerpt (from http://www.eight-cubed.com/articles/dcl_standards.html):

|        ||$       on warning then goto nopriv
        $       set on
        $       set process/privilege=(sysnam,sysprv)
        $!...


        $nopriv:
        $       write sys$output "Required privs: SYSNAM, SYSPRV"
        $       status = 36
        $       goto exit
        $!...
        $exit:
        $       set process/privilege=(nosysnam,nosysprv)


        $       exit status + (0 * f$verify (old_verify))
|

Is there any clever way that the following features could work with this kind of code?

1) dap (delete a paragraph): this currently deletes the whole source file - because there are no empty lines between paragraphs (an "empty" line must contain at least the $)

2) >> (indent a line): this indents the leading $ as well as the rest of the line; instead, the dollar should stay in column 1, and only the rest of the line should be indented

3) J (join lines); gqq (format the line): if multiple lines become one line, or vice versa, the dollars are not removed/inserted as they should be

What I have come up with so far is using 'comments':
    :set comments=:$
This at least puts the $ sign on each new line.
I suppose you could have a pair of maps; one of which removes all the leading "$"s, and the other would put them back:

map <F4> :%s/^\$//e
map <s-F4> :%s/^/$/e

Furthermore, you could automate this if you're confident enough in their effects:

au BufRead  * if &ft =~ "dcl" | :%s/^\$//e|endif
au  BufWrite * if &ft =~ "dcl"|:s/^/$/e|endif

You might wish to put these into a .vim/ftplugin/dcl.vim file (I'd have to guess at the actual OpenVMS directory, perhaps [wherever.vimfiles.ftplugin]dcl.vim ?).

Of course, these are untested.

Regards,
Chip Campbell

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui