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

Autoformat not working on save #191

Closed
jrock2004 opened this issue Jun 21, 2019 · 5 comments
Closed

Autoformat not working on save #191

jrock2004 opened this issue Jun 21, 2019 · 5 comments

Comments

@jrock2004
Copy link

Do you want to request a feature or report a bug?
bug

What is the current/expected behavior?
Just installed the plugin and when I save the file, nothing changes. If I do :Prettier it then formats my document. I ran echo g:prettier#autoformat and it returns a 1

What version of vim-prettier are you using - (output of :PrettierVersion) ?
0.2.7

What version of prettier are you using - (output of :PrettierCliVersion) ?
1.18.2

What is your prettier executable path - (output of :PrettierCliPath) ?
/Users/jcostanzo/.dotfiles/config/nvim/plugged/vim-prettier/node_modules/.bin/prettier

Did this work in previous versions of vim-prettier and/or prettier ?
This is my first time using this so its unknown

@lfarroco
Copy link

lfarroco commented Aug 6, 2019

look for the following text in the README:

To enable vim-prettier to run in files without requiring the "@Format" doc tag..

In that section there are some options to enable autosaving (the code snippets should be added to the ~/.vimrc file)

@mitermayer
Copy link
Member

Please follow the README instructions as mentioned by @lfarroco

If you still got issues feel free to re-open this

@vadimshvetsov
Copy link

vadimshvetsov commented Apr 15, 2020

The docs are not clear for me. It took 15 mins to make it works on autosave. It's not easy to understand, that options below must be used together for execute prettier on autosave without "@Format" or "@prettier" tags.

let g:prettier#autoformat = 1
let g:prettier#autoformat_require_pragma = 0

Or for autoformating only when you have config file in directory or parent.

let g:prettier#autoformat_config_present = 1
let g:prettier#autoformat_require_pragma = 0

@drjosephliu
Copy link

I agree with @vadimshvetsov . This should be more clear on the readme

@mitermayer
Copy link
Member

@drjosephliu Please feel free to submit a PR for it we would love contributions!

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