Linux.com

auto indent in vim

$ vim ~/.exrc

set shiftwidth=4
set softtabstop=4
set nu

if has ("autocmd")
     filetype plugin indent on
endif

:wq

vim parse ~/.exrc on start,

shiftwidth & softtabstop makes sure that when 'tab' key pressed, it insert 4 spaces and when 'backspace' key pressed, delete 4 spaces.

 

'nu' print line number

 

'filetype plugin indent on' loads auto indent plugin for the file type (.extension) if avalable


 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFS426 Linux Performance Tuning
    21 Apr » 24 Apr - Virtual
    Details
  2. LFS520 OpenStack Cloud Architecture and Deployment
    05 May » 09 May - Virtual
    Details
  3. LFD320 Linux Kernel Internals and Debugging
    12 May » 16 May - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board