How to make vim insert same amount of spaces on tab?

I would like on pressing <Tab> for vim to insert the same amount of spaces each time. It seems that it doesn't do this by default but instead aligns to the nearest multiple of tabstop from the start of the line.

For example, consider I have the following config in my .vimrc

set tabstop=4
set shiftwidth=4
set expandtab

The arrow shows what happens on pressing <Tab> after typing hi. The vertical line | indicates the vim cursor's new position.

This is the current situation:

hi->|
1234| // Aligned to a 4 space boundary

However, this is what I am looking for:

hi--->|
123456| // Exactly 4 spaces from 'i'


from Recent Questions - Stack Overflow https://ift.tt/2ToH1kR
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)