You uses everal IDEs and each maintain its own spelling dictionary.
You want to merge them so words from PyCharm are available in PhpStorm too.
To discover dictionaries in your computer, extract words and merge them:
$ merge-dictionaries --merge
This is a potentially destructive operation: your dictionary files will be overwritten.
To print all the words:
$ merge-dictionaries --extract
This is a safe operation.
To create a personal dictionary file for your Hunspell dictionary:
$ merge-dictionaries --extract > $HOME/.hunspell_default
This is a safe read-only operation for your IDE files. This can overwrite your default Hunspell dictionary if it already exists.
You can specify --format=<format>
as argument to the extract task:
$ merge-dictionaries --extract --format=JetBrains
It will output a dictionary file you can use in any IDE compatible with that format.
This is a safe read-only operation.
Create a $HOME/.config/merge-dictionaries.conf
with the following content:
git:
- git@github.com:luser/dictionary.git
See below if you wish to host the Git repository locally.
Currently, the following IDEs are supported
- All JetBrains IDEs: application-level dictionary
- Hunspell: read personal dictionaries
- Git repository
To add an IDE, you need to provide the following methods:
- sources
- a list of paths candidates for the IDE dictionary
- a method extracting words from the dictionary
- output
- a method to dump the extracted words in the IDE format
- write
- a method to save the files, normally you can call the ones created
You can commit your changes to the upstream by following instructions at https://agora.nasqueron.org/How_to_contribute_code
The canonical repository is https://devcentral.nasqueron.org/source/merge-dictionaries.git
Not yet implemented. Here a proposal to implement this.
Curently, the workflow is:
[ extract ] -> { words } -> [ publish ]
You want to add a new transformation step:
[ extract ] -> { words } -> [ transform ] -> { words cleaned up } -> [ publish ]
Add a transform step with an allowlist of the words to remove.
It's not easy to detect if the user has removed a word explicitly from a dictionary, as we don't cache extracted words.
If you want to host the repository on your local machine, use a bare repository:
$ git init --bare ~/.cache/dictionary
Initialized empty Git repository in /usr/home/luser/.cache/dictionary/
You can push to a bare repository, but non-bare ones are protected against pushes, to avoid a desync between your index and the working files.
Alternatively, you can prepare a script to do this sequence of operation:
$ merge-dictionaries --merge
$ cd ~/.cache/dictionary
$ git reset
BSD-2-Clause, see LICENSE file.