On 17-Dec-2010 22:17, Ingo Karkat wrote:
> 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.

I sat down and implemented the missing bits. With the just released CountJump
version 1.40, you should be able to define section motions ]], ][, [[ and [] 
via:

call CountJump#Region#Motion#MakeBracketMotion( '<buffer>', '', '', '^\$\s*\S', 
1)

and overwrite the inner/outer paragraph text objects via:

call CountJump#Region#TextObject#Make( '<buffer>', 'p', 'ai', 'V', '^\$\s*\S', 
1 )

Both of these assume that lines containing just "$" followed by whitespace do
not belong to a paragraph.

I hope this helps!

-- regards, ingo

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