Gitea: Configure tab size when viewing a file

Created on 19 Nov 2019  路  10Comments  路  Source: go-gitea/gitea

Hi,

Is there an option to configure how many spaces a tab contains?

Our java files are indented with tabs and when I view them, every tab seems to be 8 spaces wide.
Normally I would expect 4 spaces for java, c# and similar languages

revieweconfirmed

Most helpful comment

please reopen. (stalebot is bad project management)

does this mean that managing projects that use tabs is not supported on Gitea? it looks like .editorconfig is used when editing files, but ignored when viewing them.

workaround: add custom/templates/custom/header.tmpl:
css <style> .tab-size-8 { tab-size: 4 !important; } </style>

All 10 comments

I think you can put a .editorconfig in your repo and some aspects like the editor will honour it, not sure about repo viewer.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

This issue has been automatically closed because of inactivity. You can re-open it if needed.

Hello,

How can I change Gitea's global tab size from 8 to 4 ?

Thanks.

please reopen. (stalebot is bad project management)

does this mean that managing projects that use tabs is not supported on Gitea? it looks like .editorconfig is used when editing files, but ignored when viewing them.

workaround: add custom/templates/custom/header.tmpl:
css <style> .tab-size-8 { tab-size: 4 !important; } </style>

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

up

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

u

I build Gitea with this patch:

diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index e4107dfa9..38c4c661f 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -185,18 +185,18 @@ func NewFuncMap() []template.FuncMap {
            )
            if ec != nil {
                if value, ok = ec.(*editorconfig.Editorconfig); !ok || value == nil {
-                   return "tab-size-8"
+                   return "tab-size-4"
                }
                def, err := value.GetDefinitionForFilename(filename)
                if err != nil {
                    log.Error("tab size class: getting definition for filename: %v", err)
-                   return "tab-size-8"
+                   return "tab-size-4"
                }
                if def.TabWidth > 0 {
                    return fmt.Sprintf("tab-size-%d", def.TabWidth)
                }
            }
-           return "tab-size-8"
+           return "tab-size-4"
        },
        "SubJumpablePath": func(str string) []string {
            var path []string
Was this page helpful?
0 / 5 - 0 ratings

Related issues

internalfx picture internalfx  路  3Comments

kifirkin picture kifirkin  路  3Comments

mirhec picture mirhec  路  3Comments

flozz picture flozz  路  3Comments

jorise7 picture jorise7  路  3Comments