我使用Vim/gVim進行javascript(節點)編程。我的jslint在我的文件類型插件中作爲makeprg進行了連接。這裏的錯誤格式運用於:在Vim中調整/對齊errorformat輸出
efm=%-P%f,
\%A%>%\\s%\\?#%*\\d\ %m,%Z%.%#Line\ %l\\,\ Pos\ %c,
\%-G%f\ is\ OK.,%-Q
這裏是JSLint的輸出:
routes/pcr.js
#1 'db' was used before it was defined.
db.collection('pcrs', function (err, collection) { // Line 11, Pos 5
#2 'db' was used before it was defined.
db.collection('pcrs', function (err, collection) { // Line 23, Pos 5
#3 'BSON' was used before it was defined.
collection.findOne({'_id': new BSON.ObjectID(id)}, function (err, item) { // Line 24, Pos 40
這裏是輸出到quickfix窗口:
routes/pcr.js|11 col 5| 'db' was used before it was defined.
routes/pcr.js|23 col 5| 'db' was used before it was defined.
routes/pcr.js|24 col 40| 'BSON' was used before it was defined.
列號後,我就像左邊那個出來說2位數字(我希望一個文件不超過99個錯誤!),使它看起來像:
routes/pcr.js|11 col 5| 'db' was used before it was defined.
routes/pcr.js|23 col 5| 'db' was used before it was defined.
routes/pcr.js|24 col 40| 'BSON' was used before it was defined.
我想這也會影響行號0-9。是否可以有條件地填充輸出?
那麼怎麼樣!你搖滾,很好的答案。現在來溝通那個perl來看魔術...... – regretoverflow 2013-05-04 19:08:22
對不起,我重寫了我醜陋的單線性腳本。新的可能比這更清晰。 – ernix 2013-12-23 07:37:27