Monday, August 10, 2015

Re: How exactly does one use the mode() function

I probably should have added that I am not looking for the input() function here, I'm trying to understand why this approach doesn't work.

I've also tried it with 'mode() != "N"', which causes vim to hang indefinitely, which seems reasonable if it is in Insert mode, though there is no indication in the buffer that this is so, it will not accept keyboard input of any sort.

On Mon, Aug 10, 2015 at 7:39 AM, Graham Lawrence <gl00637@gmail.com> wrote:
I routinely pass parameters to mappings by simply typing them in at the beginning of a line and running the mapping which begins 'ld0'

I reasoned I could extend this principle to functions as follows:
    norm "pP0i
    sleep 1
    while mode() != "n" | sleep 1 | endwh
    norm l"ry0uu

That is the 'i' in the first 'norm' puts vim in Insert mode, and the while loop will then wait until the user presses <Esc>.  Instead, the function goes straight to completion, so either I am applying mode() incorrectly, or vim never enters Insert mode.  What am I missing?
--
Graham Lawrence



--
Graham Lawrence

--
--
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@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment