Monday, August 10, 2015

How exactly does one use the mode() function

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

--
--
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