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

Re: Suggestion [was: Re: Easter exercise for the reader]

Expand Messages
  • Bram Moolenaar
    ... Ah, now I understand. :silent unmap should not bother you with a message. I ll add a remark in the todo list. -- hundred-and-one symptoms of being
    Message 1 of 21 , May 1, 2000
      Ron Aaron wrote:

      > I mean that if I do:
      > unmap <cr>
      > when <cr> wasn't mapped to something, I get the error message "No such
      > mapping". If I e.g. want to make sure that certain keys are unmapped:
      >
      > au BufEnter * unmap <cr>
      >
      > I get that annoying message every time I go into a buffer unless that key was
      > mapped. So instead, I do something like:
      >
      > au BufEnter * if mapcheck('<cr>')!='' | unmap <cr> | endif
      >
      > which is a lot more work than I should have to do, IMHO.
      >
      > Does this make sense?

      Ah, now I understand. ":silent unmap <cr>" should not bother you with a
      message. I'll add a remark in the todo list.

      --
      hundred-and-one symptoms of being an internet addict:
      181. You make up words that go with the "happy tune" your modem makes
      while dialing your ISP.

      /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
      \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
    • Flemming Madsen
      ... Yes, if :silent would cause :redir to stop messages from going to the screen, this would fill the void nicely. Of course it _does_ enable your .vimrc file
      Message 2 of 21 , May 1, 2000
        Bram Moolenaar wrote:
        >
        > Flemming Madsen wrote:
        >
        > [about switching of messages for a sequence of commands]
        > > Bram Moolenaar wrote:
        > > > My main reason to not want to include a way to disable messages in a
        > > > general way, is that people will switch it on, forget about it, and
        > > > complain that something doesn't work. It's even worse when some
        > > > system-wide vimrc file sets the option for you.
        > > >
        > > > Rule #1: Don't give somebody a tool that he's going to hurt himself with.
        > >
        > > Ok, that explains why :redirect is not actually a redirect :-)
        > > If it was (or had an option for it) we would already have the feature
        > > that most (?) people seem to expect from the silent command.
        >
        > Yes, :redirect doesn't work very nice. I'm still looking for a solution.
        > Perhaps by not echoing until the user is asked to hit a key. Still, any
        > prompt would be missing then. How do you know you have to hit return if the
        > hit-return prompt isn't there? Probably have to remember the last message and
        > output that before waiting for the key.
        >
        > > I would like to propose a combination of both worlds:
        > >
        > > :divert[!] reg command Redirect message output of 'command' to register
        > > 'reg'. Append to the contents of the registers {a-z}
        > > if its name is given uppercase {A-Z}. If [!] if
        > > given, messages will also appear on the screen.
        > > Use the "black hole" register '_' for discarding
        > > output altogether.
        >
        > I think ":silent redir" can be used for this. Then it can work exactly like
        > ":redir", but without echoing the messages. The problem mentioned above will
        > probably have to be solved anyway, and it avoids the need for another command.
        >
        > Hopefully the script writer remembers that any output from the script will be
        > redirected too, an ":echo "hello"" won't work!
        >
        Yes, if :silent would cause :redir to stop messages from going to the screen,
        this would fill the void nicely. Of course it _does_ enable your .vimrc file
        or a faulty/rogue function to disable/hide messages on a global basis.
        That's fine with me though. :redir END is the programmers responsibility anyway.

        Regards
        /Flemming
      Your message has been successfully submitted and would be delivered to recipients shortly.