I prefer to use tab
than white space
(may be a little different from most of others)
But I found, when I hit Enter
at the end of line, it will add some white spaces, but not tab. So, I have to delete them and press tab.
I want to know how to set vim as:
- use only tab to indent the lines
- a tab looks like 4-spaces, but actually is a tab
- when hit
enter
at the end of a line, the new line is started with only tabs
I've googled for this for a while, but not found a good answer. Thank you in advance
UPDATE
The answer @Alok has provided works well in most of cases. But I just found, sometimes, it depends on the file type. For example, if you are editing a haml
file, and there is a haml.vim
in your vimfiles/indent/
, then all the tabs will be converted to space
. So if you want it to be tab
only, you should modify(or delete) the corresponding indent file.
$HOME/vimfiles/after/indent/haml.vim
. See:help after-directory
for more info. – Nefrubyr