tags:

views:

152

answers:

1

I want to use only tabs without space

\t\t...\tdef

not

\t \tdef

or

\t\t  def
+4  A: 

So long as you are using noexpandtab, vim will only add spaces when 'tabbing' manually if the setting of the softtabstop option does not equal the tabstop option value.

Similarly, vim won't use spaces when you use the << or >> commands if you use the same setting for shiftwidth as you do tabstop.

vim won't stop you from adding spaces inbetween tabs if you really try. If you want to spot these you can make occasional use of the :set list command or even use a syntax highlight rule to show them. (The sequence '\t ' is usually 'wrong'.)

Charles Bailey
Instead of higlighting I what auto removing unnecessary spaces.
dotneter
You mean something like: `:s/ \{8\}^I/^I^I/gc` then `:s/ \+^I/^I/gc` where `^I` is usually typed `<C-V><tab>` ?
Charles Bailey
May be is there any way to not use replace?
dotneter
What do you mean? Appropriate tabstop settings will mean that vim won't automatically insert spaces; if you don't want them you won't be inserting them manually. This only leaves the possibility that you already have them. If this is the case, then logically you _have_ to replace them (somehow), how else are they going to disappear?
Charles Bailey
Ok. I copy some code from internet \s\s\s\s\sdef and paste it in vim and I want to get automaticly this "^I^Idef"my settings ts=2 sw=2. Can I do it somehow without additional key pressing?
dotneter
Not with a conventional put command, I don't believe, but you could set up a new function and keybinding to do a :put and a :retab! in one go?
Charles Bailey
retab is helpfull, thanks
dotneter