Hi Chip,

thanks for the suggestion. Unfortunately, this will not work because
of line
continuations, which look like this:

    $ write sys$output "some text ", "more text ", -
                  "even more text ", -
                  "and yet more"
    $ write sys$output "next bit"

In other words, there may be lines with no leading $s. The <s-F4>
mapping would
tend to put "back" the leading $s even on lines which did not have it
in the
first place (lines 2 and 3 above).

Line continuations, i.e. lines with no leading $, are always preceded
by a line
ending with a "-" (hyphen), as seen in the example above. One could
rely on
this, perhaps, to detect that lines 2 and 3 in the excerpt above
should get no
leading dollar. However, I think you can have lines ending with a
hyphen, which
do not mean a line continuation, so this would not work either. (I am
not
totally convinced about this, but I seem to remember something like
that.)

But your idea is exactly what I am thinking: if only vim could somehow
ignore
the leading $, ignore that it is there, and process all commands as if
the
dollar was not there...

Thanks,
Sam

On Dec 18, 3:58 am, Charles E Campbell Jr <drc...@campbellfamily.biz>
wrote:
> 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