Search code examples
bashvimviex

How to go back in ex mode from vi?


I'm learning vi/vim. Recently, I've faced with some uncertain point. When I run:

ex somefile

The ex editor opens. Ok, good. After some play I run:

:vi

Now I'm in normal vi mode. Everything is clear here. But the question is: How can I go back to ex mode (the first time I run ex filename from bash)? I've tried [shift]+[q] (hence Q), but nothing happens.


Solution

  • You didn't say what version of vim you were using, but the help (:help ex-mode) does say this:

    Note: In older versions of Vim "Q" formatted text,
    that is now done with gq. But if you use the
    vimrc_example.vim script "Q" works like "gq".

    So you could try gq in normal mode or help also says

    gQ Switch to "Ex" mode like with "Q", but really behave
    like typing ":" commands after another.

    In that case you could try gQ from normal mode.