In this extremely short article we will provide you with the steps required to make the width of a single TAB only 4 spaces wide.
This especially useful when using Visual Mode within VIM , in that you can indent large portions of text.
Steps
Within your ~/.vimrc file add the following lines.
set shiftwidth=4 " change the number of space characters inserted for indentation set expandtab " insert spaces whenever a tab key is pressed set softtabstop=4 " makes the spaces feel like real tabs
Additional
There are 2 other VIM commands that can be especially useful, when dealing with TAB’s. They are:
:set list – shows unprintable characters.
:retab – converts all TABs to spaces.
Note : Both of the above commands are run directly within the VIM terminal.
Latest posts by Rick Donato (see all)
- NETCONF & YANG: Automate Network Configs via Python - April 2, 2026
- Palo Alto – How to Configure Your Next-Generation Firewall - April 2, 2026
- How to Harden Linux SSH: Keys, Fail2ban & Ciphers - March 1, 2026
Want to become a UNIX expert ?
Here is our hand-picked selection of the best courses you can find online:
UNIX Administration Fundamentals
Vim Masterclass
and our recommended certification practice exams:
Delta Practice Tests