

Writing like a pro with vale & neovim
source link: https://bhupesh.me//writing-like-a-pro-with-vale-and-neovim/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Writing like a pro with vale & neovim
📅️ Published: May 26, 2022 • 🕣 3 min read

Vale is a syntax-aware prose linter built for all you writers out there. With more than 100 releases so far vale is 5 year old project and is used by writing folks in companies like Google, Microsoft, IBM, RedHat to name a few. I have recently started to use vale in my everyday writing workflow and it has a significant impact on what words I choose to convey ideas. I mostly use neovim for writing, so we will be covering how to setup vale
and use it with neovim.
Just like when writing software we use static analysis tools to find common problems, vale
aims to help writers configure what words/prose to choose while writing technical documentation.
Installing vale
Download a latest version of vale from their github releases page.
Writing styles & the vale config
Vale requires to have a .vale.ini
config file located either in your $HOME
directory or a relative project directory. Below is a sample configuration that I use personally
# This goes in a file named either `.vale.ini` or `_vale.ini`.
StylesPath = styles
MinAlertLevel = suggestion
# External packages
Packages = Google, Readability, alex, proselint, IBM
# Only Markdown and .txt files; change to whatever you're using.
[*.{md,txt}]
# List of styles to load.
BasedOnStyles = alex, proselint
Once you create this file, run vale sync
to download/update any External packages you have mentioned in the config.
A vale style is a repository of “rules” that define what words need to be reported by vale. The rules are defined in a yml
file.
If you prefer to customize the config yourself, I recommend using the config generator
The vale project has come up with 7 style packages. Some of the popular styles are based on writing rules from organisations like Google & Microsoft, some of which are listed below:
You can find more vale styles on github by vale-style topic.
Choosing what styles suits best for your writing needs depends on your writing style, If you are working with a team of writers in a organisation I would suggest using styles from Google & Microsoft which are more strict but good for teams. If you have a personal blog or you write solo, use styles like alex
or proselint
whose rules are more lenient, I recommend give all the rules a try by switching the BasedOnStyles
property in vale config.
Setting up Neovim
The null-ls.nvim neovim plugin let’s you use vale as a prose linter.
Install null-ls.nvim using Plug
Plug 'jose-elias-alvarez/null-ls.nvim'
Require the lua plugin,
require("null-ls").setup({
sources = {
require("null-ls").builtins.diagnostics.vale,
},
})
If you are using a native vim
config use lua HERE doc.
lua << EOF
require("null-ls").setup({
sources = {
require("null-ls").builtins.diagnostics.vale,
},
})
EOF
Make sure you have a
.vale.ini
or_vale.ini
somewhere in$HOME
or at the current working directory.
Here is how the in-editor suggestions look like

As you can see, some of the suggestions are not being rendered by NeoVim correctly. To fix this, you can use the trouble.nvim plugin to get a nice VSCode like interface for diagnostics.

And that’s it, enjoy writing!
Recommend
-
12
Writing Ruby Programs Like a Python Programmer Feb 15, 2020 As of late, I have found myself writing a number of what amount to "Non Rails" tools. These are tools that tend to: Run continuously in the backg...
-
5
Tuesday, 26 January 2021 23:42 Vale Graeme Philipson, a great Australian IT journalist and analyst Featured By
-
8
-
6
Responses (20)
-
7
Vale's Higher RAII, the pattern that saved me a vital 5 hours in the 7DRL Challenge Mar 22, 2022 — Evan Ovadia This year's
-
5
Surprising Weak-Ref Implementations: Swift, Obj-C, C++, Rust, and Vale Such shenanigans, right under our noses! Apr 4, 2022...
-
8
...
-
5
Vale a pena investir em DOGE e SHIBA INU? agosto 31, 2022 by Daniel Scocco Vale a pena investir em Dogecoin? Uma pergunta similar que recebo bastante é se vale a pena investir em S...
-
8
Virgin Orbit’s Journey from the Final Frontier to Financial Collapse No one ever claimed that exploring the cosmos would be simple, but certain endeavors are best left behind as quickly as possible. Take, for instance, Sir R...
-
7
Linting for prose.Workflow managementOpen SourceOur reviewWhat we likeLinter CLI for enforcing a specific writing style. It’s not prescriptive - there are lots of open styles used...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK