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

139377Re: Something to wrap a selection

Expand Messages
  • Paul Isambert
    Sep 29, 2013
    • 0 Attachment
      Harry Putnam <reader@...> a écrit:
      > Paul Isambert <zappathustra@...> writes:
      >
      > > I say goodbye here, the code follows. I’ll hope you’ll be satisfied
      > > this time (there might be glitches, I did not test the command much,
      > > just basic tries).
      >
      > Oh boy, yup this baby works now.
      >
      > Man, you went so far beyond the call of duty, and let me tell you that
      > it was really appreciated here.

      If duty there was, it was only not to give you half-baked code. Plus
      writing scriptlets is so funnier than dish-washing.

      > There are so many examples and techniques in that code I will be
      > learning from it for a good while.
      >
      > Oh, and I promise not to post one more thing to this thread.. : )

      But you should if the code goes wrong. By the way there was a small
      mistake. In:

      let s:commentfile = expand("<sfile>:p:h") . "/.markchangerc"
      if filereadable(s:commentfile)
      let s:data = readfile(s:commentfile)
      for line in s:data
      if line !~ '^#' && line =~ '='
      let s:matches = matchlist(line, '\([^=[:blank:]]\+\)\s*=\s*\(\S\+\)')
      if len(s:matches)
      let s:markchangecomments[s:matches[1]] = s:matches[2]
      endif
      endif
      endfor
      endif

      you should replace all occurrences of “line” with “s:line”, otherwise
      it defines a global variable whereas you want it to be only visible in
      the script (I’m used to loop variables being local, à la Lua).

      Best,
      Paul

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 10 messages in this topic