Loading ...
Sorry, an error occurred while loading the content.
 

Re: Basic scripting question

Expand Messages
  • Christian Brabandt
    Hi meino.cramer! ... Use setline() or first delete its contents and then paste your buffer in there. ... Use the normal dd command or use the :d _ command or
    Message 1 of 3 , Jan 30, 2011
      Hi meino.cramer!

      On So, 30 Jan 2011, meino.cramer@... 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
    • meino.cramer@gmx.de
      ... Hi Christian, thanks for your help! :) setline() seems to be the swiss army knife for me... ;) Best regards, mcc -- You received this message from the
      Message 2 of 3 , Jan 30, 2011
        Christian Brabandt <cblists@...> [11-01-30 10:40]:
        > Hi meino.cramer!
        >
        > On So, 30 Jan 2011, meino.cramer@... 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
        >

        Hi Christian,

        thanks for your help! :)

        "setline()" seems to be the swiss army knife for me... ;)

        Best regards,
        mcc

        --
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.