Skip to content

4278 auto syntax 'shell' for executable text file without shebang -- follow *nix philosophy - #4288

Open
kuvaldini wants to merge 3 commits into
micro-editor:masterfrom
kuvaldini:4278-syntax-executable-noshebang
Open

kuvaldini wants to merge 3 commits into
micro-editor:masterfrom
kuvaldini:4278-syntax-executable-noshebang

Conversation

@kuvaldini

@kuvaldini kuvaldini commented Nov 1, 2026 •

Copy link
Copy Markdown

one more try, suggest simpler or faster code if you can!

Note

benefit: basic syntax highlight instead of just grey for any script

Tip

CONSISTENCY follow *nix philosophy -- executable text with no shebang is interpreted via /bin/sh

never mind C++ is more expressive and laconic in such a simple cases, but shell is quickest.

@dmaluka

dmaluka commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Why not a plugin?

@kuvaldini

Copy link
Copy Markdown
Author

@dmaluka does micro-editor has plugin ecosystem?

@dmaluka

dmaluka commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

@kuvaldini

Copy link
Copy Markdown
Author

@dmaluka i tried to use some of plugins suggested on site, they are mostly outdated and buggy. i am not sure plugins work in stable way.

and don't think CONSISTENCY is a feature to plug-it-in. moreover i am sure it is must have to be logically in sync with *nix/GNU convention.

@JoeKar

JoeKar commented Nov 2, 2026

Copy link
Copy Markdown
Member

moreover i am sure it is must have to be logically in sync with *nix/GNU convention.

Apparently, Vim and Emacs aren't *nix/GNU-compliant either. 😉
Can you name one terminal editor doing this by default?

@kuvaldini

Copy link
Copy Markdown
Author

may it be this is first one to follow what is 30+ yrs is standard de facto ;-)

@JoeKar

JoeKar commented Nov 3, 2026

Copy link
Copy Markdown
Member

I'm still not convinced.
This shouldn't be integrated directly into the editor in this form.
The use case is somewhat niche, so you should start by creating it as a plugin for yourself, as suggested by @dmaluka.
You can suggest it in the Show and Tell section of the discussion forums.

@dmaluka

dmaluka commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Also, even if we wanted to build this feature into the editor, enforcing this feature unconditionally without allowing the user to disable it (which is what this PR does, AFAICS) is definitely a no-go.

Also, this feature kind of conceptually conflicts with the default syntax feature we added in #2933: it makes it ineffective for executable files. Which doesn't mean the two features could not be used together, but it probably means this feature should not be enabled by default.

@kuvaldini

Copy link
Copy Markdown
Author

plugin is lua it is more cumbersome than in go.

no conflicts with #2933, executableTextFileWithoutShenbang is the last try to detect, since 2933 does not want to explicitly declare NO_SYNTAX.

'micro' was good for some short files. also these small no-shebang scripts ;)

this feature should not be enabled by default.

would you like to wrap it with if config("syntax SHELL for executableTextFileWithoutShenbang")?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants