2
  • When I execute:

    :exe "normal! \<c-o>"
    

    , it works as expected (it jumps to the previous cursor location).

  • But when I execute:

    :exe "normal! \<c-i>"
    

    , it outputs the E471 error:

    E471: Argument required

    Then I need to prepend with 1 to make it work:

    :exe "normal! 1\<c-i>"
    

Is it a normal behaviour?

Please note I'm using vim-gtk (graphical).

Vim version : 7.4
Rustines : 1-1689

6

Yes I think it's a normal behavior.

In :help keycode, you can read that <C-I> and <Tab> have the same decimal keycode (9):

<Tab>       tab         CTRL-I    9 *tab* *Tab*

Which means that Vim and gVim can't make the difference between the two keys.
You can find a technical reason for this here.

So "\<C-I>" is translated into a literal tab character.
After the translation, Vim probably parses the tab as a syntax character separating a command from its arguments (here :normal from {commands}) ; like a space.
Since there's nothing after your tab, Vim doesn't pass anything to :normal, and the latter complains with the error E471: Argument required.

The solution is given in :help :normal:

    {commands} cannot start with a space.  Put a count of
    1 (one) before it, "1 " is one space.

You have to prefix the {commands} with 1 when they begin with a space (and probably with a tab).

Hitting 1 then Ctrl-I in normal mode has the same effect as hitting Ctrl-I alone.
But here on the command-line, by prefixing <C-I> with a count, you prevent Vim from parsing it as a syntax character, but rather as a part of the argument {commands}.

  • 1
    It looks a real good answer; I will look at it a bit before accepting it – yolenoyer Apr 30 '16 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.