开发者

Deleting tabs when using tabs as spaces

开发者 https://www.devze.com 2023-01-04 00:51 出处:网络
I know that the general tabs vs spaces thing is as old as the hills and mostly comes down to personal preference/sticking to the style of your team, I just wanted to ask a practical question about usi

I know that the general tabs vs spaces thing is as old as the hills and mostly comes down to personal preference/sticking to the style of your team, I just wanted to ask a practical question about using spaces in Visual Studio. There are certain things about tabs that bug 开发者_StackOverflow中文版me and I wouldn't mind changing to spaces while we're a small team. It would be no different for writing the code in the first place but would mean you'd have to delete/backspace 4 times where I'd previously press it once.

Is there any easy way of deleting tab sized amounts of spaces easily (other than dragging with the mouse etc.) or if you've gone through the changeover yourself is it something that eventually doesn't bother you at all?


In Visual Studio, use Shift-Tab. This will go back one tab-stop, even when using soft tabs.


I've been plagued by the same issue for years. Finally, I did something about it. Let me officially announce version 0.1.0 of the TabSanity Visual Studio extension for VS 2012.

It doesn't just stop at backspaces. It handles the delete key as well as arrow key navigation. Mouse interactions planned for near-future development.

There are some minor bugs I still need to resolve, but the groundwork is laid and I'm making steady progress. It's an open source project, so feel free to contribute on GitHub.


I don't think there is an easy answer to this problem. I use Xcode and Visual Studio, and both have really annoying indentation. Maybe there's an option to disable autoindentation altogether.


In Visual Studio 2015

  1. Open file.
  2. Select all lines you wish to modify (or CTRL+A for entire file).
  3. Choose Edit->Advanced->"Untabify selected lines"


Yes, there's a very easy way.
You set your Visual Studio options (Tools/Options/Text Editor) to use spaces instead of tabs and then you open a source file and Ctrl-E,D (Edit/Advanced/Format Document) and it will convert them all for you!

Yay for automation!

0

精彩评论

暂无评论...
验证码 换一张
取 消