1、在.vimrc中添加

Plug 'prettier/vim-prettier', { 'do': 'yarn install', 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html', 'php'] }

let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.json,*.css,*.scss,*.less,*.graphql,*.php Prettier

vim 安装vim-prettier

vim 安装vim-prettier

2、这样你的vim就可以:w就可以自动格式化代码了,

如何想要git commit hook格式化代码的话,请参考

https://blog.csdn.net/qq_35774849/article/details/107070026

 

 

 

 

 

相关文章:

  • 2021-11-24
  • 2021-12-16
  • 2021-06-15
  • 2021-12-02
  • 2021-08-18
  • 2021-08-11
  • 2021-09-16
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2022-01-04
  • 2021-07-10
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2021-11-08
相关资源
相似解决方案