Tyranus-Blog
Blog von tyranus.de

Tag: auto-indent

2. April 2016

You know the problem you paste something into vi and the result looks like this?

vi: Paste with indent

This is because you are editing a file of a type that vi knows as filetype it uses auto indent for.

You can check the file type vi detected with the following command:

In the case of the screenshot above it was: filetype=javascript  which vi uses auto indent for by default.

So what I de before pasting some text block ist setting the file type to simply text.

And the result looks like this:

vi: Paste without indent

Looks better and takes less time than correcting all those whitespaces and tabs. Right?

You can simply change your file type back afterwards.