【问题标题】:vim-autoformat and scalafmt not workingvim-autoformat 和 scalafmt 不工作
【发布时间】:2017-05-15 22:48:04
【问题描述】:

我正在使用带有 scalafmt 的 https://github.com/Chiel92/vim-autoformat 插件,并且在我的 .vimrc 中有以下内容:

" scalafmt settings
let g:formatdef_scalafmt = "'scalafmt --stdin'"
let g:formatters_scala = ['scalafmt']

noremap <localleader>f :Autoformat<CR>

let g:autoformat_autoindent = 0
let g:autoformat_retab = 0
let g:autoformat_remove_trailing_spaces = 0

当我从外部 vim 调用 scalafmt 时,我已经验证它正在工作。没有显示错误消息,但缓冲区没有得到更新。

运行 :CurrentFormatter 会导致:Selected formatter: scalafmt

我的配置中是否缺少某些内容?

【问题讨论】:

  • 使用插件的问题跟踪器。
  • vim-autoformat 在我的设置中与其他外部格式化程序(例如 Java)一起工作,所以我不确定这是一个插件问题。 scalafmt 似乎也设置正确,因为cat Hello.scala | scalafmt --stdin 将格式化文件写入控制台。
  • 您可以设置:set verbose=1并查看有关问题的消息

标签: scala vim vim-plugin autoformat


【解决方案1】:

只是为了让答案完整,

let g:formatdef_scalafmt = '"scalafmt --stdin 2>/dev/null"'
let g:formatters_scala = ['scalafmt']

Issues using vim-autoformat with scalafmt 建议的那样

【讨论】:

    猜你喜欢
    • 2013-06-07
    • 1970-01-01
    • 2012-07-18
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 2020-09-05
    相关资源
    最近更新 更多