Spaces as tabs and backspace behavior in Vim

烈酒焚心 提交于 2019-12-31 08:52:13

问题


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?


回答1:


Try set softtabstop=4




回答2:


You can try using ^T and ^D.

:help i_CTRL-T
:help i_CTRL-D

These allow to insert or delete (more like backspace though) a number of spaces equal to shiftwidth.




回答3:


I have the same problem with you earlier, but I soon find it do not make any sense to just backspace 1 character in real coding. but if you really want backspace 1 character, you can just type one more space, then you can delete only one character each time you hit space bar even if you got where there you typed the 4 spaces tab



来源:https://stackoverflow.com/questions/4151448/spaces-as-tabs-and-backspace-behavior-in-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!