Prolog support for Vim users

拜拜、爱过 提交于 2019-11-29 13:20:04

问题


I am starting with Prolog programming using XSB.

What syntax highlighting script or plugin for vim editor would you suggest for (XSB) Prolog ?


回答1:


Vim (7.3) comes with filetype-specific settings and syntax highlighting for Prolog. Just make sure that your file is detected as such (i.e. :setlocal filetype? prints prolog), and you have the usual :filetype plugin on and :syntax on in your ~/.vimrc.

Vim auto-detects *.pdb and *.pl (depending on contents, can also be Perl); but you can configure additional patterns, see :help new-filetype.




回答2:


The Vim support for Logtalk is an alternative for syntax coloring of Prolog files. Given that Logtalk extends Prolog, you will get nice syntax coloring for official and de facto standard Prolog features. The latest version is available here:

https://github.com/LogtalkDotOrg/logtalk3/tree/master/coding/vim

You will need to configure Vim, however, to use the Logtalk syntax highlighter support for the Prolog files (basically to recognize the file extensions that you're using for Prolog; e.g. XSB, by default, prefers .P). Also do try different Vim themes. Some of them are more pleasant than others.




回答3:


There are two big plugins "set" for working with Prolog in Vim:

  • adimit/prolog.vim - widely known but abandoned
  • soli/prolog-vim - lesser known, but more updated and advanced

You can check files of the second - they are extending standard prolog.vim which comes with Vim, but including it. Moreover they support different flavours of Prolog - SWI Prolog, GNU Prolog, etc. You can use them as an examble and create your own.



来源:https://stackoverflow.com/questions/19610734/prolog-support-for-vim-users

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