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

Re: execute commands in macros based on key mappings

Expand Messages
  • Antoine J. Mechelynck
    Mikolaj Machowski wrote: [...] ... [...] ... There is no :help silence I guess you meant :help :silent Tony.
    Message 1 of 6 , Oct 1, 2002
    • 0 Attachment
      Mikolaj Machowski <mikmach@...> wrote:
      [...]
      > Look into :help silence
      [...]
      > Mikolaj

      There is no :help silence

      I guess you meant :help :silent

      Tony.
    • Lukas Ruf
      ... Thanks for the hint! I installed it. However, how can I bind this to an imap definition? Thanks, Lukas -- Lukas Ruf http://www.lpr.ch
      Message 2 of 6 , Oct 3, 2002
      • 0 Attachment
        On Tue, 01 Oct 2002, Mikolaj Machowski wrote:

        >
        > 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
        >
        Thanks for the hint! I installed it.

        However, how can I bind this to an imap definition?

        Thanks,

        Lukas
        --
        Lukas Ruf
        http://www.lpr.ch http://www.maremma.ch
        http://www.{{topsy,nodeos}.net,{promethos,netbeast,rawip}.org}
        Wanna know anything about raw ip? Join rawip@... on www.rawip.org
      • Benji Fisher
        ... First, wrap the Command-mode lines in a function: fun! SigSearchAndDestroy() exe normal! /^$ ma if search( ^ ---*$ , bw ) if getline( . ) =~ --$
        Message 3 of 6 , Oct 3, 2002
        • 0 Attachment
          On Thursday, October 3, 2002, at 11:24 AM, Lukas Ruf wrote:
          >
          > On Tue, 01 Oct 2002, Mikolaj Machowski wrote:
          >
          >>
          >> 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
          >>
          > Thanks for the hint! I installed it.
          >
          > However, how can I bind this to an imap definition?

          First, wrap the Command-mode lines in a function:

          fun! SigSearchAndDestroy()
          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
          endfun

          The function name is up to you, but should start with a capital letter
          and contain only alphanumeric characters IIRC. Then, make an :imap to
          call the function,

          :imap <F4> :call SigSearchAndDestroy()<CR>

          Note the leading : and trailing <CR> in the second argument.

          HTH --Benji Fisher

          P.S. For more examples, see my file of examples, foo.vim
          http://vim.sourceforge.net/scripts/script.php?script_id=72
        • Lukas Ruf
          ... Yes, it helped a lot! Thanks a lot! Lukas -- Lukas Ruf http://www.lpr.ch http://www.maremma.ch
          Message 4 of 6 , Oct 3, 2002
          • 0 Attachment
            On Thu, 03 Oct 2002, Benji Fisher wrote:

            > HTH --Benji Fisher
            >
            Yes, it helped a lot!

            Thanks a lot!

            Lukas
            --
            Lukas Ruf
            http://www.lpr.ch http://www.maremma.ch
            http://www.{{topsy,nodeos}.net,{promethos,netbeast,rawip}.org}
            Wanna know anything about raw ip? Join rawip@... on www.rawip.org
          Your message has been successfully submitted and would be delivered to recipients shortly.