vim 环境写 markdown 的插件推荐

 2023-09-13 阅读 16 评论 0

摘要:vim 环境写 markdown 的插件推荐 本文将介绍在vim环境写markdown文档或者博文的一些好用插件 markdown语法高亮及识别 博主使用vim-markdown做语法高亮。安装方法很简单,这里以pathogen为例: cd ~/.vim/bundlegit clone https://github.com/plasticboy/vim-mar

vim 环境写 markdown 的插件推荐

本文将介绍在vim环境写markdown文档或者博文的一些好用插件

markdown语法高亮及识别

博主使用vim-markdown做语法高亮。安装方法很简单,这里以pathogen为例:

 
  1. cd ~/.vim/bundle
  2. git clone https://github.com/plasticboy/vim-markdown.git

安装完以后plugin自动由pathogen生效,由于我们是用markdown写jekyll博客,这里需要额外对YAML语法做个配置。在~/.vimrc中加上以下配置

 
  1. let g:vim_markdown_frontmatter=1

代码补全/代码模板(snippet)

博主使用的markdown代码补全工具是snipMate工具来源于github。具体安装方式可以见项目的文档,也可以参照下面的摘录的缩略版:

 
  1. % cd ~/.vim/bundle
  2. % git clone https://github.com/tomtom/tlib_vim.git
  3. % git clone https://github.com/MarcWeber/vim-addon-mw-utils.git
  4. % git clone https://github.com/garbas/vim-snipmate.git
  5. % git clone https://github.com/honza/vim-snippets.git

这里比较蛋疼的一点是:vim-markdownvim-snipmate无法自动配合使用,目前看来是因为前者将filetype设置为mkd,而后者需要filetype为markdown才能够生效。由于博主不懂vim-script所以用比较粗暴的方式解决了这个问题。markdown 编辑器,如果有哪位读者知道怎么用vimrc或者其他方法解决这个问题的话,欢迎在博文下面留言!

 
  1. % cd ~/.vim/bundle/vim-snippets
  2. % cp markdown.snippets mkd.snippets

关于SnipMate还是UltiSnaps

重复造轮是IT界一直在试图避免的事情,那为什么github上会同时存在两个star数量过千代码补全工具呢?关于这个问题vim-snippets的作者正面回答过。简单的总结就是UltiSnaps需要python的支持,这样的依赖显然是不精简的,因此作者写了一套pure vim的解决方案。具体可见以下的摘录:

Q: Should “snipMate be deprecated in favour of UltiSnips”?

A: No, because snipMate is VimL, and UltiSnips requires Python. Some people want to use snippets without having to install Vim with Python support. Yes - this sucks.

One solution would be: Use snippets if they are good enough, but allow overriding them in UltiSnips. This would avoid most duplication while still serving most users. AFAIK there is a nested-placeholder branch for snipMate too. snipMate is still improved by Adnan Zafar. So maybe time is not ready to make a final decision yet.


原文发布时间:2015-04-13

本文来自云栖合作伙伴“linux中国”

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/51341.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息