Converting TABs to space

I had to convert a file from ESP-IDF that was using TAB for spacing, and tried to use vim “retab” and “:%s/\t/ /g” with not luck to keep the visual position of the text.

Fortunately the solution is very simple:

$ expand -t 8 core-isa.h > output_filename


2 thoughts on “Converting TABs to space

  1. I used Vi back in my Unix days but never liked it. I feel the same about Vim, plus I’ve lost my skills with it after years of using geany. I like geany and it converts tabs to spaces with a simple replace command using regex expression. Vi IS useful for its universality.

    1. Yes, I think vi/vim are very powerful when you master it correctly. It requires much time and effort to get there.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s