[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabstospaces always set to true for no reason in .py files #2213

Closed
halsten-dev opened this issue Sep 17, 2021 · 4 comments
Closed

tabstospaces always set to true for no reason in .py files #2213

halsten-dev opened this issue Sep 17, 2021 · 4 comments

Comments

@halsten-dev
Copy link

Description of the problem or steps to reproduce

Don't really know for sure but it happens when I open .py files in micro and I execute the :

show tabstospaces

It returns true. Then I execute

set tabstospaces false

If I execute the show again this time it returns false. I execute a retab

If I quit micro after saving, and open the same file again and execute the previous show it will returns true again.

I even tried to fix the "tabstospaces" to false inside the file ~/.config/micro/settings.json with this syntax :

{ "*.py": { "tabstospaces": false } }

I was unable to find help sorry if I missed the solution somewhere.

Thanks for your help. Micro is amazing thanks for the great work too.

Specifications

Version: 2.0.10
Commit hash: b976385
Compiled on August 07, 2021

OS: MacOs 11.5.1
Terminal: zsh

@dmaluka
Copy link
Collaborator
dmaluka commented Sep 17, 2021

There is a built-in ftoptions plugin which overrides some options depending on the file type, e.g. forces tabstospaces=true for Python and tabstospaces=false for Go.

The easiest option for you is just to disable this plugin:

set ftoptions false

@halsten-dev
Copy link
Author

Thanks for your answer that helps a lot.

Is there a way to configure this plugin ? this could be interesting.

But I can't understand why this plugin to this for python by default because it is well known that python need tabs.

@dmaluka
Copy link
Collaborator
dmaluka commented Sep 17, 2021

It's a very simple plugin with hardcoded option settings: https://github.com/zyedidia/micro/blob/master/runtime/plugins/ftoptions/ftoptions.lua

It is compiled into micro, however you can override it without recompiling by copying the runtime/plugins/ftoptions directory from micro source to your ~/.config/micro/plug and modifying ftoptions.lua.
Well... I've been thinking that ~/.config/micro/plug/ftoptions would override the compiled-in plugin, but I see it doesn't: looks like both copies of the plugin are loaded, with no guarantee that ~/.config/micro/plug/ftoptions will take precedence. It seems worth fixing.
Anyway, you can name it e.g. ~/.config/micro/plug/ftoptions2 and set ftoptions false to ensure that only your ftoptions2 takes effect.

But I can't understand why this plugin to this for python by default because it is well known that python need tabs.

I'm not at all familiar with Python but a brief googling suggests that the recommended indent style for Python is 4 spaces.

@halsten-dev
Copy link
Author

Indeed sorry I was confused. Actually it's heavily debated.

This being said you gave me a good solution that allows me to continue using Micro, thanks for that !

Have a nice day

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

No branches or pull requests

2 participants