On 17-Dec-2010 21:24, Samuel Ferencik wrote:
> Hi,
> 
> DCL is a scripting language for OpenVMS, whose lines of code must all start 
> with
> a $.
(...)
> 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 $)

You'd have to (over-)write the "a paragraph" text object in Vimscript. There are
a few libraries that help with that. Incidentally, I have written one, 
CountJump.
    http://www.vim.org/scripts/script.php?script_id=3130
I wish I could include a line that would magically invoke the script to just do
what you need, but it's not yet that trivial. However, I do have a use case
quite similar to DCL, and once I get to implement that, it should be one line.
But also have a look at the other scripts referenced on the plugin page; maybe
one of those is a better fit.

> 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

I have written IndentCommentPrefix for exactly that purpose:
    http://www.vim.org/scripts/script.php?script_id=2529
It just requires that you properly :set comments; which you've already done.

> 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

For joining, you could put something like this into .vim/ftplugin/dcl.vim
(assuming you have a filetype detection or :setf dcl manually):

nnoremap <buffer> <silent> J Jc/\%# \?\$[ \t]\+\ze\w/e<CR> <Esc>ciw <Esc>

I don't know how you would want to react to lines that start with labels and
those "!..." directives(?); you may want to tweak the regexp to suit DCL.

> What I have come up with so far is using 'comments':
>     :set comments=:$
> This at least puts the $ sign on each new line.

Good start, and good luck!

-- regards, ingo
-- 
  -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
  --      http://vim.sourceforge.net/account/profile.php?user_id=9713    --

-- 
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