As Sato mentioned in comments,
:help v_> will show you help for the best tool you can use for this.
>> in normal mode will indent the current line;
>3> will indent the current line and the following two lines;
<< will decrease indentation.
Another feature that works will in combination with
> can be found at
:help text-objects. (
a[, and so on.) For example in C-style code that uses curly braces,
>iB to indent the current block including curly braces, or only indent the lines between the curly braces, respectively. For Python code,
>ap (indent a paragraph) may be more useful, but using visual mode to select the lines as described in
:help v_> is even more adjustable.
For the general answer to "How to add a character/some text at the beginning of each line?" i.e., when you want to insert something other than tabs or spaces, there are a couple ways:
:%normal Itext to insert will prepend
text to insert to every line in the file.
% can be replaced with any range you like. (See
:help range and also
Or you can use Ctrlvto enter blockwise-visual mode, use
k to select a column of characters, then
I (capital) to insert text at that point in all selected lines. (It will only be visible in all the lines after you Esc and then make another motion of any sort.) This has the advantage that you can enter text at ANY point in the line, not only at the beginning. (See