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

106287Pls help with writing this plugin

Expand Messages
  • googler
    Aug 2, 2009
    • 0 Attachment
      Hi all,

      I'm trying to write a vim script (plugin) that will do the following.
      When I visually select a part of the text and press the key F2, it
      will highlight this text. Now I may go to other parts of the file and
      highlight other sections using the same mechanism. After a while I
      return to my previously highlighted section and with the cursor on it,
      I press F2 again. This will remove the highlight from this section.

      I have been trying to code this up but haven't been successful so far.
      I don't have any experience with vim scripting before. This is what
      I'm trying to do. I select the part visually. So the marks '< and '>
      will have information on start and end of the selected text. Now I
      call getpos() on each of these marks to get their line number and
      column number and store these in variables (so that they can be used
      when I want to remove highlighting). In order to highlight the text
      from (line=10,col=7) to (line=24,col=33), I do :match ErrorMsg /\%10l\
      %7c\_.*\%24l\%33c . But in this case, my line and column numbers are
      stored in variables. So how do I use these in the match command? Is
      there a way?

      A related question is, is it possible to create marks not by going to
      a certain position and doing a ma (for example), but just by
      specifying the line and column numbers? Also, is it possible to copy a
      mark a to another mark b?


      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 3 messages in this topic