Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spaces as tabs and backspace behavior in Vim

Tags:

vim

In my .vimrc I have:

set shiftwidth=4 set tabstop=4 set expandtab 

set to use 4 spaces instead of tab when I hit the Tab button. But when I hit backspace after a Tab, I need to backspace all 4 spaces. Is there a way to have it so when I go to backspace a "tab" it can delete all 4 spaces?

like image 372
brandon Avatar asked Nov 11 '10 04:11

brandon


People also ask

How do I backspace a tab in Vim?

In edit mode: One more level, press tab. Going back one level, press backspace. In command mode: arrow keys or h/l. @hlovdal That can also be done by setting softtabstop without having to use actual tab characters in the file.

How do I insert a tab instead of spaces in Vim?

In short: set et and set noet to switch tab and space as need.

How do I set spacing in Vim?

Set 'tabstop' and 'shiftwidth' to whatever you prefer and use 'expandtab'. This way you will always insert spaces. The formatting will never be messed up when 'tabstop' is changed. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use a |modeline| to set these values when editing the file again.


1 Answers

Try set softtabstop=4

like image 137
GWW Avatar answered Oct 01 '22 22:10

GWW