Add ability to customize tab size #6618

Closed
opened 2025-11-02 07:01:37 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @delvh on GitHub (Jan 3, 2021).

  • Gitea version (or commit ref): -
  • Git version: -
  • Operating system: -

Description

Many projects and files use different tab sizes: The preferred ones are 2, 4 and 8.
And yet, there is currently no option to customize this for each file in a Pull Request, or when viewing the raw source code inside the file tree.
It would be nice if users could customize themselves how many spaces a tab should represent.
As far as I'm aware, currently only setting the tab size globally using hard-coded values (see #9071) is supported.

What to implement

  • option for users to configure the tab size in a PR for every file/ globally (so that every file in this PR will have tab size 2,4 or 8)
  • option for users to configure the tab size when viewing raw source code in the file tree

Both options must not be persisted, simply calling them with a default value should be enough.

Originally created by @delvh on GitHub (Jan 3, 2021). - Gitea version (or commit ref): - - Git version: - - Operating system: - ## Description Many projects and files use different tab sizes: The preferred ones are 2, 4 and 8. And yet, there is currently no option to customize this for each file in a Pull Request, or when viewing the raw source code inside the file tree. It would be nice if users could customize themselves how many spaces a tab should represent. As far as I'm aware, currently only setting the tab size globally using hard-coded values (see #9071) is supported. ## What to implement - option for users to configure the tab size in a PR for every file/ globally (so that every file in this PR will have tab size 2,4 or 8) - option for users to configure the tab size when viewing raw source code in the file tree Both options must not be persisted, simply calling them with a default value should be enough.
GiteaMirror added the issue/needs-feedback label 2025-11-02 07:01:37 -06:00
Author
Owner

@silverwind commented on GitHub (Jan 3, 2021):

We don't need a separate option, users should just commit a .editorconfig into the repo instead which makes tab preference work everywhere including GitHub. We do support editorconfig in the online code editor, just not in the code view.

@silverwind commented on GitHub (Jan 3, 2021): We don't need a separate option, users should just commit a `.editorconfig` into the repo instead which makes tab preference work everywhere including GitHub. We do support editorconfig in the online code editor, just not in the code view.
Author
Owner

@delvh commented on GitHub (Jan 3, 2021):

Well, already the fact that many/most people don't know about that, speaks against it in my opinion.
Start a poll somewhere, I'm 95% sure if you ask 100 random developers/ git users, 50 of them will not know about the editorconfig.
While it might currently be possible, it definitely is rather hacky.
And having the .editorconfig does not invalidate the additional option:
As I have mentioned, that can then be the default values used.
By offering the option to manually change the tab size for a specific PR, nothing gets lost.
Instead, it is enhanced, as less code will be horribly misplaced.

@delvh commented on GitHub (Jan 3, 2021): Well, already the fact that many/most people don't know about that, speaks against it in my opinion. Start a poll somewhere, I'm 95% sure if you ask 100 random developers/ git users, 50 of them will not know about the editorconfig. While it might currently be possible, it definitely is rather hacky. And having the `.editorconfig` does not invalidate the additional option: As I have mentioned, that can then be the default values used. By offering the option to manually change the tab size for a specific PR, nothing gets lost. Instead, it is enhanced, as less code will be horribly misplaced.
Author
Owner

@CirnoT commented on GitHub (Jan 3, 2021):

Should we also make separate config for line length? And whether it's tab or space? How about using tab/space differently for different files (.yaml)? Should we also support that?

These are rhetorical questions really, as you can see, Gitea is not a place to handle this for you.

@CirnoT commented on GitHub (Jan 3, 2021): Should we also make separate config for line length? And whether it's tab or space? How about using tab/space differently for different files (`.yaml`)? Should we also support that? These are rhetorical questions really, as you can see, Gitea is not a place to handle this for you.
Author
Owner

@6543 commented on GitHub (Jan 3, 2021):

I think this will just add eafen more complex code :/ - .editorconfig is the way to go if you asked me

@6543 commented on GitHub (Jan 3, 2021): I think this will just add eafen more complex code :/ - `.editorconfig` is the way to go if you asked me
Author
Owner

@techknowlogick commented on GitHub (Jan 4, 2021):

Closing as there is an established standard and we shouldn't compete with it

@techknowlogick commented on GitHub (Jan 4, 2021): Closing as there is an established standard and we shouldn't compete with it
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6618