Sunday, January 30, 2011

Re: Basic scripting question

Hi meino.cramer!

On So, 30 Jan 2011, meino.cramer@gmx.de wrote:

> this is a very basic question ... I am currently learning vim
> scripting.
>
> With getline(.) I can get the contents of a line of a buffer.
>
> But: i
> How can I replace a line in the buffer with another contents?

Use setline() or first delete its contents and then paste your buffer in
there.

> How can I delete a line completly so it become an empty one or
> vanishes?

Use the normal dd command
or use the :d _ command
or use setline('.', '')

> How can I insert a line at a certain point?

Use the append() or setline function calls.

> How can a define the position in the text where this all will happen?

position the cursor somewhere using cursor() or setpos(). Alternatively,
if you use setline() or append(), they take as argument, on which line
to operate.


Mit freundlichen Grüßen
Christian
--

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

No comments: