VIM: How to add custom markers before lines

一曲冷凌霜 提交于 2020-01-07 05:42:17

问题


I want to mark erroneous lines a source code. I detect the incorrect lines using an external program (e.g., flake8). When I save the source, I would like VIM to execute the external program and mark invalid lines.

I thought about different possibilities of "marking" the lines, like underlining full line or changing background colour. What I would like to do is to have an additional column on the left hand side of the text, where I could place some markers (e.g., ">") indicating the offending lines.

I know about the flake8 vim plugin, it displays full flask output and I want just small markers.

Question:

How can I add such a "special column"?

I thought about a separate window with width=1, but maybe there are better options.

(This question migrated from here after innaM's comment)


回答1:


for your requirement, I suggest syntastic plugin, like others.

for your question, "add a customer marker before lines/special column" you should take a look sign.

:h sign

has more details, with examples.

Many plugins (syntastic, showmarkers....) have used this feature. you could add your own text, highlight and so on for your own sign.




回答2:


Take a look at the sources of the Syntastic plugin. Maybe you don't even have to write your own plugin, but can leverage Syntastic's powers.




回答3:


Did you try Syntastic? It does everything you want and more.

The column you speak of is the "sign column", you can read all about it in :h signs.



来源:https://stackoverflow.com/questions/16836145/vim-how-to-add-custom-markers-before-lines

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!