如何使用的QuickFix在Vim来调试的bash脚本 [英] How to use quickfix in Vim to debug Bash scripts

查看:197
本文介绍了如何使用的QuickFix在Vim来调试的bash脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Vim每天写shell脚本。我一直在阅读有关的的quickfix 的窗口,我认为这可能加速我的编辑 - 运行 - 修复周期效率。

I use Vim every day to write shell scripts. I have been reading about the quickfix window, and I think it could speed up my productivity in the edit-run-fix cycle.

如果我理解正确,我写我自己的 errorformat 功能,以Vim来能够捕获错误,并将其引入的的quickfix 的窗口。但是,这似乎是很复杂。

If I understood properly, I have to write my own errorformat function in order to Vim to be able to catch the errors and introduce them into the quickfix window. But this seems to be really complicated.

有没有利用一个更容易/更便捷的方式的的quickfix 的写的bash脚本时,窗口的Vim?

Is there an easier/more convenient way to take advantage of the quickfix window in Vim when writing Bash scripts?

推荐答案

Vim的quickfix窗口旨在加快在编辑 - 编译 - 修改周期。由于的bash脚本不会被编译,我们要代替别的东西了这一步,可以在当前脚本针砭。

Vim's quickfix window is designed to speed up the edit-compile-edit cycle. Since Bash scripts do not get compiled, we have to substitute something else for that step that can point out errors in the current script.

你想要的是一个静态分析的bash脚本工具即可。有两个很好的: shellcheck 并的 checkbashisms 。您将要至少安装 shellcheck ,因为它是对的多个COM prehensive,但安装 checkbashisms 将帮助抓几个问题。

What you want is a static analysis tool for Bash scripts. There are two good ones: shellcheck and checkbashisms. You'll want to install at least shellcheck, as it's the more comprehensive of the pair, but installing checkbashisms will help catch a few more issues.

要这两个工具集成到Vim的时候,你需要一个叫做插件 Syntastic 。检查项目页面安装说明。

To integrate those two tools into Vim, you need a plugin called Syntastic. Check the project page for installation instructions.

一旦你安装了一切,你就可以得到你的Bash脚本的基本问题及时反馈:

Once you've got everything installed, you'll be able to get immediate feedback on basic issues in your Bash script:


  • 使用:SyntasticCheck 来强制检查运行

  • 如果您希望的quickfix窗口出现,运行:错误

  • Use :SyntasticCheck to force the checker to run
  • If you want the "quickfix" window to appear, run :Errors

这篇关于如何使用的QuickFix在Vim来调试的bash脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆