Giter Club home page Giter Club logo

pangu.vim's Introduction

PanGu.vim

盘古插件用于自动格式化、标准化中文排版。

它会将一些非标准,或不推荐的排版方式,在保存文件时进行自动格式化、标准化。

功能

  • 中英文字符间增加一个半角空白。
  • 中文前后的半角标点转成全角标点。
  • 全角英文、数字转成半角字符。
  • 连续的句号自动转省略号。
  • 感叹号、问号最多允许连续重复 3 次。
  • 其他中文标点符号不允许重复出现。

支持的文件格式

推荐在以下文件格式中使用:

  • Markdown (*.md, *.markdown)
  • Text (*.text, *.txt)
  • Wiki (*.wiki)
  • Vim 中文文档 (*.cnx)

如果想在其他格式的文件中使用这个功能,可以执行 :Pangu 命令。

同时可以在 vimrc 中开启自动规范化功能。开启方式:

autocmd BufWritePre *.markdown,*.md,*.text,*.txt,*.wiki,*.cnx call PanGuSpacing()

注意:目前只对纯文本格式的文件支持较好,其他如 html 等,请谨慎开启。

如果有合适的文件格式推荐,请提交 Issue

安装

via Vundle:

Bundle "hotoo/pangu.vim"

用法

:Pangu 命令

手动执行该命令,将当前文件进行规范化。

:PanguDisable 命令

禁止自动规范化。

:PanguEnable 命令

启用自动规范化。

技巧

批量规范化多个文档。

$ vim a.md b.md c.md

:argdo Pangu | update
:wq

持久化禁用

在编辑的文档中任何位置注明 PANGU_DISABLE,则整个文档不自动规范化。

参考

pangu.vim's People

Contributors

gooooloo avatar hotoo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.