> is there a way of entering a tab in vi w/o using the tab key?
> the reason is because i configured my editor to insert spaces instead
> of tabs when i press the tab key. but sometimes i'd like to actually
> insert a tab. how do i do this? i tried <ctrl-i> but that still
> inserts spaces.
> ideally it would be nice if there was a general way of entering
> characters by ascii values that way i could enter other characters as
> well like carriage return.
Hmmmmmm... sounds like you have a version/implementation of vi(1)
other than ye olde classic UNIX vi(1), or nvi(1). Perhaps you're
using vim(1) - it is provided as or for the default for vi(1) on at
least some LINUX distributions. Or perhaps you did this tab --> space
configuration via some other means?
Nevertheless, for vi(1), or some approximation thereof, any and/or all
of these may be useful and effective (I show control characters as
preceded by ^):
In insert mode, use
^V^I
For ^I, above, you can try the TAB key, and you can also try using the
control and I keys. You can also try ^I using the control and I keys
without the ^V first.
You can read in the output of a command, e.g. (precise syntax may vary
depending on your echo) from command mode:
:.r !echo -e '\011'
That should give you a line after the current line with a single tab
on it. Once you've got the tab there, you can always yank it into a
named buffer, e.g. place the cursor on the line that ends with that
tab, then from command mode, enter:
"ty$
That will yank that character (the tab) into named buffer t.
Then, any time you want to place a tab, from command mode, do:
"tp
to place it after the cursor, or
"tP
to place it before the cursor.
This approach can be generalized for dealing with most arbitrary ASCII
characters within vi(1). It may not support non-ASCII characters, and
it may not support the ASCII null character, and it won't support
newline, but it should handle all other ASCII characters.
Followup-to: set because it seemed fitting