Giter VIP home page Giter VIP logo

micro-autofmt's Introduction

micro-autofmt

Multi-language formatting plugin for the Micro editor

Setup

  • git clone and make
  • Install whichever formatters you want to use

Usage

  • Run fmt to format the current file.
  • Files will be formatted on save, unless fmt-onsave is set to false (with Ctrl-e > set fmt-onsave false).

Supported formatters

Language Formatter
C/C++/C# clang-format
Python yapf
Racket fmt
JavaScript prettier
Rust rustfmt nightly

Credits

This project is intended as a replacement for the now-dead fmt-micro. o7


All contributions are welcome by pull request or issue.

micro-autofmt is licensed under the GNU General Public License v3.0. See LICENSE for full text.

micro-autofmt's People

Contributors

a11ce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

micro-autofmt's Issues

set fmt-onsave false -- Invalid Option

Hi

I am facing issues with the plugin running on the wsl system for Windows (Ubuntu 20.04 LTS).

When typing the option to disable formatting on save I get this:

image

Running the command CTRL-E > fmt does nothing even when saving the file and reopening it

I am running the latest version of Micro:

image

Any ideas?

Cheers

Can't get it to work at all (?)

I'm sorry that this is not a more useful issue, but I just can't get this plugin to work at all. I installed it using the command on the micro plugins page:

$ micro -plugin install autofmt

Which yielded this result:

Downloading "autofmt" (1.0.0) from "https://github.com/micro-editor/plugin-channel/releases/download/plugins/micro-autofmt-1.0.0.zip"
One or more plugins installed.

So it seems like installation was successful. However, in a JS project with Prettier installed, I modified a JS file and saved the changes — and nothing happened. I pressed Ctrl+E, typed fmt, and pressed Enter — and still nothing happened.

So I cloned this repo, entered it, and ran make, which yielded this result:

mkdir -p ~/.config/micro/plug/micro-autofmt/help
cp autofmt.lua ~/.config/micro/plug/micro-autofmt/autofmt.lua
cp repo.json ~/.config/micro/plug/micro-autofmt/repo.json
cp help/autofmt.md ~/.config/micro/plug/micro-autofmt/help/autofmt.md

There were no errors, so I assume it was successful. I again tried editing the JS file and saving the changes, but still no formatting seemed to be applied. I also pressed Ctrl+E, typed fmt, and pressed Enter again; but still nothing happened.

I use Prettier in VSCode all the time, and I assumed (perhaps incorrectly) that this plugin would behave pretty much the same way. Is that true? Am I doing something obviously wrong? I'd appreciate any help you can provide! 🙏

Replace yapf in python with black and/or ruff

To my best knowledge, yapf isn't as popular of a formatter as black for python. Ruff is another implementation of black that's getting some traction right now. Would you be open to replacing yapf with one or both of these?

The way it's written now, it doesn't seem like multiple formatters are supported per language, so given a choice let's go with black since it's more popular right now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.