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)
- How to Configure a BIND Server on Ubuntu - March 15, 2018
- What is a BGP Confederation? - March 6, 2018
- Cisco – What is BGP ORF (Outbound Route Filtering)? - March 5, 2018
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:
AlphaPrep Practice Tests - Free Trial