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

Re: input() inside mapping eats rest of mapping

Expand Messages
  • Benji Fisher
    ... Yes. See the TWIN() function in foo.vim for an example of how to use a mapping and a function for this sort of thing.
    Message 1 of 3 , Mar 1, 2004
      On Mon, Mar 01, 2004 at 02:09:50PM +0200, Yakov Lerner wrote:
      > I tried to use input() inside mapping and got unexpected results.
      > Let's say I execute the following line:
      >
      > :map ;; :let c=input("Enter something ")<cr>iabc<esc>:echo "--> c=".c<cr>
      >
      > , then press ;;
      >
      > Unexpectedly, I don't get prompt "Enter something ". Instead,
      > input() seems to be fed with what follows in mapping. Command 'iabc<esc'
      > is not executed. Is it how it is supposed to be ?
      >
      > Yakov

      Yes. See the TWIN() function in foo.vim for an example of how to
      use a mapping and a function for this sort of thing.

      http://www.vim.org/script.php?script_id=72

      HTH --Benji Fisher
    • Antony Scriven
      ... Antony
      Message 2 of 3 , Mar 1, 2004
        Yakov Lerner wrote:

        > I tried to use input() inside mapping and got unexpected results.
        > Let's say I execute the following line:
        >
        > :map ;; :let c=input("Enter something ")<cr>iabc<esc>:echo "--> c=".c<cr>
        >
        > , then press ;;
        >
        > Unexpectedly, I don't get prompt "Enter something ". Instead,
        > input() seems to be fed with what follows in mapping. Command 'iabc<esc'
        > is not executed. Is it how it is supposed to be ?

        :help inputsave()
        :help inputrestore()

        Antony
      Your message has been successfully submitted and would be delivered to recipients shortly.