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

Displaying vim error messages

Expand Messages
  • Daniel P. Wright
    Hello, I would like to display one of vim s in-built error messages from a script. For example, E347: No more file filename found in path . I could just
    Message 1 of 2 , Feb 5, 2013
      Hello,

      I would like to display one of vim's in-built error messages from a
      script. For example, "E347: No more file "filename" found in path". I
      could just use :echoerr, but then the string wouldn't be localised if
      people are using translated versions of vim, and if the text of E347
      were ever to change I'd have to update my plugin if I wanted to match
      it.

      I've looked through the documentation but most of what I could find
      seemed just to be summaries of existing error messages rather than ways
      of displaying them or extracting their text. Is there any way to print
      an error based on its message ID (E347 in this case)?

      Any pointers greatly appreciated,

      Dani.

      --
      --
      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.
    • Tony Mechelynck
      ... No. You can make Vim produce the message if you let the error happen and don t catch it. Otherwise, Vim error messages are such that you can t really
      Message 2 of 2 , Feb 5, 2013
        On 06/02/13 03:20, Daniel P. Wright wrote:
        > Hello,
        >
        > I would like to display one of vim's in-built error messages from a
        > script. For example, "E347: No more file "filename" found in path". I
        > could just use :echoerr, but then the string wouldn't be localised if
        > people are using translated versions of vim, and if the text of E347
        > were ever to change I'd have to update my plugin if I wanted to match
        > it.
        >
        > I've looked through the documentation but most of what I could find
        > seemed just to be summaries of existing error messages rather than ways
        > of displaying them or extracting their text. Is there any way to print
        > an error based on its message ID (E347 in this case)?
        >
        > Any pointers greatly appreciated,
        >
        > Dani.
        >

        No. You can make Vim produce the message if you let the error happen and
        don't catch it. Otherwise, Vim error messages are such that you can't
        really trigger them. As you noticed, you can use :echoerr but it won't
        be localized.

        See:
        :help rethrow
        :help try-echoerr


        Best regards,
        Tony.
        --
        Despising machines to a man,
        The Luddites joined up with the Klan,
        And ride out by night
        In a sheeting of white
        To lynch all the robots they can.
        -- C. M. and G. A. Maxson

        --
        --
        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.
      Your message has been successfully submitted and would be delivered to recipients shortly.