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

Re: some vim standard ? (saving env)

Expand Messages
  • Sylvain Viart
    Hi Luc, Here is my answer about the small set of function I suggested. ... Of course, cursor() and search() solve common problems. But specific language
    Message 1 of 1 , Nov 30, 2002
    • 0 Attachment
      Hi Luc,

      Here is my answer about the small set of function I suggested.

      Luc Hermitte wrote:
      >
      > Sylvain Viart wrote:
      > > Like Moving cursor functions,
      >
      > This function can be written as a very short line.
      >
      Of course, cursor() and search() solve common problems. But
      specific language function could be shared between plugins. Like
      XML text motion:

      finding tag (siblings, parent, current surrounding)
      finding comment
      finding processing instruction
      finding angle bracket <>
      ...

      > > changing text functions,
      >
      > I guess you are interrested in other functions that : |functions|
      >
      In fact, in this case I'm speaking about API, something like:

      Replace(ms, me, string)

      Which could replace the text marked by 2 named marks ms and me
      with the variable string.

      Would be nicer than...

      :exe "norm `".ms."c`".me."\<c-r>=string\n\e"


      ...which is also one line of code ! ;)

      > > saving and setting user param functions for register, mark, mapping,
      >
      > Could you be more specific ?
      > For instance, I have two plugins (menu-map & misc_map) that help me to
      > define complex mappings and menus.
      >
      When I speak about saving user 'something' I mean that a script
      should not change user environment if it could be avoided.

      For example saving register is pretty simple:

      func Afunc()
      let old_reg_r=@r
      ...
      let @r=old_reg_r
      endf

      Saving mapping is more difficult, but no more needed with <SID>
      in much case. There's a script for that:
      http://vim.sourceforge.net/script.php?script_id=9

      Saving marks, as I used in the snippet above, can be difficult
      because of text movement on insert and delete.

      For this specific case I'm currently working on another system
      which gives the script a set of mark which can be scrapped.
      So the script doesn't care about restoring mark because it wont alter
      user habitual marks.

      Regards,
      --
      - Sylvain Viart -
      - Blainville - Canada -
      Je parle aussi le fran├žais.
    Your message has been successfully submitted and would be delivered to recipients shortly.