https://github.com/mrossinek/vim-verdict
A version-control-friendly prose text formatter for vim (and neovim).
https://github.com/mrossinek/vim-verdict
format git indent neovim nvim prose text vcs vim
Last synced: about 2 months ago
JSON representation
A version-control-friendly prose text formatter for vim (and neovim).
- Host: GitHub
- URL: https://github.com/mrossinek/vim-verdict
- Owner: mrossinek
- License: mit
- Created: 2019-07-10T11:39:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T14:03:55.000Z (about 6 years ago)
- Last Synced: 2025-02-23T15:45:19.488Z (over 1 year ago)
- Topics: format, git, indent, neovim, nvim, prose, text, vcs, vim
- Language: Vim script
- Homepage: https://gitlab.com/mrossinek/vim-verdict
- Size: 31.3 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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](http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/).
Installation
------------
I would recommend using [minpac](https://github.com/k-takata/minpac) which makes extensive use of the package feature
which was added to Vim 8 and Neovim.
```
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
```
:call verdict#Init()
```
You may also deactivate again with the corresponding `Deinit` function.
```
:call verdict#Deinit()
```
This function will initialize some configurable variables (see Configuration
further down) and set the following options local to your buffer:
```
formatexpr=verdict#Format()
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](https://github.com/embear/vim-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]