Giter VIP home page Giter VIP 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 vim-plug:

Plug 'asiocity/pangu.vim'

用法

:Pangu 命令

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

:PanguAddSpaceAtStart 命令

手动执行该命令, 对当前文件所有行首进行缩进处理.

:PanguDelSpaceAtStart 命令

手动执行该命令, 删除当前文件所有行首进行缩进.

:PanguB2G 命令

手动执行该命令, 对当前文件进行繁简转换.

:PanguG2B 命令

手动执行该命令, 对当前文件进行简繁转换.

技巧

批量规范化多个文档.

$ vim a.md b.md c.md

:argdo Pangu | update
:wq

持久化禁用

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

参考

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.