On Friday, November 16, 2012, Ed Kostas wrote:

> Here is a program that does not work:
>
> function! SourceRange() range
>   let @r= join(map(getline(a:firstline, a:lastline),'v:val . "|"')  )
>   @r
> endfunction
>
> command! -range Lop <line1>,<line2> call SourceRange()
>
>
>From what I understand, the problem is that a large number of statements
that go together to form a contiguous block, such as a function definition,
must be executed in one shot. You can't execute them one line at a time.
They have to be executed as one block. The only way I know of doing that is
to put them in a separate file and source the file.

While you may create a mapping to concatenate multiple lines into a long
line separated by the bar or pipe, I don't know if this will work in all
situations.

The personal mappings I use do create a temporary file and then source it.
Alternatively, I find it preferable to sometimes create a dummy file myself
and just repeatedly source it whenever I need to. Occasionally, some of the
functions I write end up being part of my permanent part of my library.

I also have mappings to delete the currently edited file, which frequently
goes hand-in-hand with the above operation.

I realize that I'm not offering any new insight, but at least you know that
there is one other person who does it the way you do, more or less.

Hope this helps,

Salman


-- 
سلمان حلیم

-- 
You received this message from the "vim_use" 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

Reply via email to