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

32804Re: execute commands in macros based on key mappings

Expand Messages
  • Mikolaj Machowski
    Oct 1, 2002
    • 0 Attachment
      On Tue, 1 Oct 2002, Lukas Ruf wrote:

      > Since not everyone follows the rules for writing emails properly (as
      > mentioned for example on Sven's home page), the execution of macros
      > fails if anything cannot be found.
      >
      > Is there a way such that I can get vim neglect the result of a command
      > (like search-backwards) and get the execution of all the macros being
      > carried out irrespective of whether one command fails.

      Look into :help silence
      And/or use if statements. Here is my function:

      exe "normal! /^$\<CR>ma"
      if search("^> ---*$", "bw")
      if getline('.') =~ "--$"
      exe "normal! o ^ You have bad sig delimiter. Insert space after '--'.\<cr>"
      endif
      exe "normal! VGd'az\<cr>"
      endif

      search() dies gracefully when string is not detected.

      Mikolaj
    • Show all 6 messages in this topic