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

Explaining initial configuration setup in README.md #181

Open
rappie opened this issue Mar 28, 2022 · 4 comments
Open

Explaining initial configuration setup in README.md #181

rappie opened this issue Mar 28, 2022 · 4 comments

Comments

@rappie
Copy link

rappie commented Mar 28, 2022

I just spend a couple of hours diagnosing why i could not get "format on save" to work. I wanted to share my experience here to save others going through the same.

At first it wasn't clear to me that you need to define a default formatter make format-all-buffer work. Eventually it turned out i just had to call format-all-ensure-formatter. This is already in the documentation but it's written in such a manner that I did not pick it up.

Suggestion: a rewrite of the "How to customize" chapter.
Adding a quickstart code example would help as well.

For example:

  (add-hook 'format-all-mode-hook 'format-all-ensure-formatter)
  (add-hook 'prog-mode-hook 'format-all-mode)
@scolej
Copy link

scolej commented Apr 7, 2022

Yes please! I too just spent an hour in the same hole.

@nettoyoussef
Copy link

Here is a basic example that also sets the default formatters:

(use-package format-all 
  :hook
  (
   (ess-r-mode . format-all-mode)
   (python-mode . format-all-mode)
   (format-all-mode-hook . format-all-ensure-formatter)
  )
  :config
  (custom-set-variables
   '(format-all-formatters (quote (("Python" black) ("R" styler))))
  )
)

@jabirali
Copy link

One thing I was a bit stuck on was how to enable multiple formatters for a single language.

For me, this worked quite well. I think perhaps adding an example like this to the README could be useful?

(use-package format-all
  :hook
  (eglot-managed-mode . format-all-mode)
  :config
  (setq-default format-all-formatters
				'(("Python" (isort) (ruff) (black)))))

@lassik
Copy link
Owner

lassik commented Feb 14, 2024

Sorry, I know the readme sucks. PRs to improve it are very welcome.

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

5 participants