I inserted the program below in both the original vi and nvi. The indented lines are indented using a single tab.

#include <stdio.h>

int main(void)
    puts("Hello world!");
    return 0;

When I try to position the cursor on the first column of an indented line (5G0), this is what happens:


The cursor is not visually on the first column! This screenshot is from nvi, but exactly the same behavior appears in original vi. If I try to move the cursor to the left using h, nvi warns: Already in the first column.

What is the reason for this behavior? Is there a way to make the cursor appear in the first visual column when it is on the first column of an indented line?

2 Answers 2


Hard tab is a single character. Eight spaces are displayed on screen but they are not a part of a buffer. Just like those trailing spaces after line ends.

In Vim if you want the cursor to move through all non-existent chars one by one you have to set virtualedit option to "all" value. In nvi, AFAIU, you just can't.

  • What is virtualedit? There is no mention of virtualedit in man nex or man nvi.
    – Flux
    Commented Jun 4, 2022 at 9:26
  • @Flux While in Vim press F1 and read how to use help.
    – Matt
    Commented Jun 4, 2022 at 10:41
  • I am not using Vim. I am using nvi (included in contemporary BSDs) and the original vi.
    – Flux
    Commented Jun 4, 2022 at 12:05
  • @Flux Oh, I didn't realize that is actually "the new Vi" clone. The explanation "why" still applies, but AFAIU you can't do anything about that in nvi except not using hard tabs at all.
    – Matt
    Commented Jun 4, 2022 at 13:14

Instead of using "0" to go the first character in the line, you can use "^" to move to the first non-blank character in the line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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