项目作者: mrossinek

项目描述 :
A version-control-friendly prose text formatter for vim (and neovim).
高级语言: Vim script
项目地址: git://github.com/mrossinek/vim-verdict.git
创建时间: 2019-07-10T11:39:45Z
项目社区:https://github.com/mrossinek/vim-verdict

开源协议:MIT License

下载


vim-verdict

vim-verdict is a simple formatting tool to help you maintain more VCS-friendly
prose text.
It follows the ideas outlined in this blog.

Installation

I would recommend using minpac which makes extensive use of the package feature
which was added to Vim 8 and Neovim.

  1. call minpac#add('https://gitlab.com/mrossinek/vim-verdict')

Other package managers work in a similar fashion.

Usage

Since the functionality provided by vim-verdict can be seen as rather
restrictive to some use-cases, it is not enabled by default for any filetype.
Therefore, in order to use it, you must enable it explicitly where appropriate.
You can do so by running

  1. :call verdict#Init()

You may also deactivate again with the corresponding Deinit function.

  1. :call verdict#Deinit()

This function will initialize some configurable variables (see Configuration
further down) and set the following options local to your buffer:

  1. formatexpr=verdict#Format()
  2. indentexpr=verdict#Indent(v:lnum)

This will enable automatic indentation while typing in insert mode.
Furthermore, you will be able to use gq{motion} to format the text moved over
by motion.

Note: I recommend using the plugin localvimrc which allows you to use local
.lvimrc files to specify additional settings on a project-basis.
This will allow you to automatize the initialization of vim-verdict where you
need it on a regular basis.
You could for example add a single .lvimrc file to the root of your website,
notes directory or tex project.

Configuration

vim-verdict makes use of the following variables:

  • g:verdict_loaded: if existing, verdict is not loaded again [Default: 1 (after initial loading)]
  • g:verdict_sentence_delims: symbols delimiting a sentence [Default: .!?]
  • g:verdict_sentence_suffixes: symbols which may follow a delimiter [Default: )]}"'']
  • g:verdict_default_textwidth: default textwidth used when no other value is specified [Default: 80]
  • g:verdict_overwrite_shiftwidth: option to overwrite the shiftwidth with a verdict specific value [no default]