I'm on a minimalist FreeBSD system and need to use the built-in vi editor to edit files. To be specific, this is not vim, or vim-tiny or other replacement. It's the "4BSD bug-for-bug compatible" nvi editor.
It works almost as expected. The man page says that control-T and control-D will indent/unindent according to shiftwidth
. Control-T does work, but control-D does not. It actually enters the ^D character into the file.
If I do get vim onto the system, control-T and control-D work as expected, so it's not an issue of the terminal mis-interpreting the key. Vi itself is not interpreting control-D.
Anyone run into this? An solutions? Using vim is not an option.
Best Answer
tl;dr;
vim
is notvi
.In
vi
, you should use Control-T instead of Tab to indent a line.If you find hard to retrain, you could add an input mode mapping from Tab to Control-T:
In the real
vi
, and in thenvi
clone (used in FreeBSD), a control-D will erase autoindent characters up to the previous "shiftwidth" boundary. It will not erase the Tab or Space characters you entered by hand, either by pressing Control-I, Tab or Space.