Quickly change tab / indent size?

4,442 views
Skip to first unread message

KerbyLane

unread,
Feb 25, 2022, 1:05:35 PM2/25/22
to BBEdit Talk
Recently I started working with a project that includes a number of files that use a tab size of 2 spaces. Almost everywhere else I'm working it is 4. I'm looking for a faster way to change the "tab width" setting than opening preferences, going into "Editor Defaults" and changing the value. Is there a slider widget or something else that I can expose to make this easier?

Thanks!

Rich Siegel

unread,
Feb 25, 2022, 1:08:41 PM2/25/22
to BBEdit Talk
On 25 Feb 2022, at 13:04, KerbyLane wrote:

> Recently I started working with a project that includes a number of files
> that use a tab size of 2 spaces. Almost everywhere else I'm working it is
> 4. I'm looking for a faster way to change the "tab width" setting than
> opening preferences, going into "Editor Defaults" and changing the value.

Since changing the preference only affects new documents or files you've never opened before, it's not really recommend for what you're trying to do.

> Is there a slider widget or something else that I can expose to make this
> easier?

The "Show Fonts" command on View -> Text Display provides tab control.

You can use the "Text Options" command on the Edit menu. (Either of those can have keyboard equivalents assigned, see the "Menus & Shortcuts" preferences.)

The Edit Options panel via the gear in the top left corner of the editing area provides a tab width control.

You can use a .editorconfig file for the project in question to enforce a project-wide two spaces per tab width.

Alternatives abound. :-)

R.

Rob

unread,
Feb 25, 2022, 5:03:22 PM2/25/22
to bbe...@googlegroups.com
Those are all great options. Thanks for the tips.

Rob


--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to a topic in the Google Groups "BBEdit Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bbedit/DGNsGmGkcJ8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/32FA56F3-6B96-4269-BF4C-43D224775948%40barebones.com.

bva

unread,
Feb 25, 2022, 6:44:48 PM2/25/22
to bbe...@googlegroups.com
Hi Kerby,

Easily scripted. This what I use to adjust tab widths. I assign it a keyboard shortcut, and can quickly cycle through widths depending on what I’m writing or viewing (I look at columns of data a lot). Not exactly what you asked for, but I think you can get the idea for a simpler one. The script goes in the Scripts folder within your Application Support folder for BBEdit, which by default is in your user Library (~/Library).

tell application "BBEdit"

set tabW to tab width of text window 1

if tabW > 64 then

set tabW to 4

else

set tabW to tabW + 12

end if

set tab width of text window 1 to tabW

end tell


HTH


_bruce__van_allen__santa_cruz_ca_
_831_429_1688_p_
_831_332_3649_c_

On Feb 25, 2022, at 10:05 AM, KerbyLane <member...@gmail.com> wrote:

Recently I started working with a project that includes a number of files that use a tab size of 2 spaces. Almost everywhere else I'm working it is 4. I'm looking for a faster way to change the "tab width" setting than opening preferences, going into "Editor Defaults" and changing the value. Is there a slider widget or something else that I can expose to make this easier?

Thanks!

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/aee66adb-01ba-41cf-8421-7ef80d6147e5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages