Checkout the CHANGELOG.md file for more information on the notices below:
You can use your favorite plugin manager for this. Here are some examples with the most popular ones:
Plug 'Pocco81/AbbrevMan.nvim'
use "Pocco81/AbbrevMan.nvim"
Plugin 'Pocco81/AbbrevMan.nvim'
NeoBundleFetch 'Pocco81/AbbrevMan.nvim'
As it's stated in the TL;DR, there are already some sane defaults that you may like, however you can change them to match your taste. These are the defaults:
load_natural_dictionaries_at_startup = true,
load_programming_dictionaries_at_startup = true,
natural_dictionaries = {
["nt_en"] = {}
},
programming_dictionaries = {
["pr_py"] = {}
}
The way you setup the settings on your config varies on whether you are using vimscript for this or Lua.
local abbrev_man = require("abbrev-man")
abbrev_man.setup({
load_natural_dictionaries_at_startup = true,
load_programming_dictionaries_at_startup = true,
natural_dictionaries = {
["nt_en"] = {}
},
programming_dictionaries = {
["pr_py"] = {}
}
})
lua << EOF
local abbrev_man = require("abbrev-man")
abbrev_man.setup({
load_natural_dictionaries_at_startup = true,
load_programming_dictionaries_at_startup = true,
natural_dictionaries = {
["nt_en"] = {}
},
programming_dictionaries = {
["pr_py"] = {}
}
})
EOF
For instructions on how to configure the plugin, check out the configuration section.
This depends on your plugin manager. If, for example, you are using Packer.nvim, you can update it with this command:
:PackerUpdate
All the commands follow the camel casing naming convention and have the AM
(Abbreviation Manager) prefix so that it's easy to remember that they are part of the AbbrevMan.nvim plugin. These are all of them:
:AMLoad <dictionary>
Loads a dictionary. If <dictionary>
hasn't been loaded, it will load it, otherwise it will show a message explaining the error.:AMUnload <dictionary>
Unloads a dictionary. If <dictionary>
has been loaded, it will unload it, otherwise it will show a message explaining the error.Although the settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!
These settings are unrelated to any group and are independent.
load_natural_dictionaries_at_startup
: (Boolean) if true, it will load the dictionaries in the natural_dictionaries
table at startup.load_programming_dictionaries_at_startup
: (Boolean) if true, it will load the dictionaries in the programming_dictionaries
tables at startup.The following tables contain the dictionaries that you want to be enabled (either at startup or by loading them with :AMLoad <dictionary>
). Although each table has its own "rules" (mentioned below), this is the general syntax that a dictionary must have:
["<prefix><name>"] = {
["<abbreviation>"] = "<element>"
}
<prefix>
: represents the group the dictionary belongs to. It can either be nt_
(if you put it in the natural_dictionaries
tables) or pr_
(if you put it in the programming_dictionaries
table).<name>
: the name you'd like to give to your dictionary.<abbreviation>
: the abbreviation itself.<element>
: what the abbreviation means (aka what will be put after you press space after the typing the abbreviation.)Here is an example:
natural_dictionaries = {
["nt_en"] = {
["adn"] = "AND",
["THe"] = "rm_am"
},
["nt_my_slangs"] {
["lmao"] = "LMAO"
}
},
programming_dictionaries = {
["pr_py"] = {}
}
In this example, we are enabling the Python
dictionary in the programming_dictionaries = {}
table and we are enabling the English dictionary (nt_en
) and custom one for slangs (nt_my_slangs
) in the natural_dictionaries = {}
table. In the English table we override the value of the adn (["adn"]
), which is the auto-correction for mistyping the word and, and set it to auto-correct to AND. Here, we are also removing the value of THe from the auto-correction's list by setting it to "rm_am"
. Of course, it also added out custom dictionary (["nt_my_slangs"]
).
AbbrevMan.nvim is not meant to be an spell checker or an auto-correction engine, it simply has some built-in in dictionaries that can be used for that purpose too. Again, that's not AbbrevMan's main purpose, but if you want to use it like that, feel free to do so.
natural_dictionaries = {}
contains all the dictionaries for the various natural languages (e.g. English). The name of each dictionary must start with the prefix nt_
, followed by the name of that dictionary.programming_dictionaries = {}
contains all the dictionaries for the various programming languages (e.g. JavaScript). The name of each dictionary must start with the prefix pr_
, followed by the extension that a file written in that language has (e.g for Python files the extension is .py
, so we put py
here).These are the lists with all the currently supported languages (remember that the idea is for you to add your own):
Note: In the State
column, working
means that the dictionary has something and it's supported, while Supported
means that AbbrevMan.nvim supports the dictionary but is under development, so it's better not to use it.
Nat. Language | Dict. Name | State |
---|---|---|
English | nt_en |
Working |
Spanish | nt_es |
Supported |
Portuguese | nt_pt |
Supported |
Polish | nt_pl |
Working |
Pro. Language | Dict. Name | State |
---|---|---|
Python | pr_py |
Supported |
Java | pr_java |
Supported |
Lua | pr_lua |
Supported |
There are no default key-bindings. However, you can set them on your own as you'd normally do! Here is an example mapping <F3>
to load the English dictionary while on normal:
For init.lua
vim.api.nvim_set_keymap(
"n",
"<F3>",
"AMLoad nt_en<CR>",
{
noremap = true,
silent = true
}
)
For init.vim
nnoremap <silent> <f3> :AMLoad nt_en<CR>
:help abbrev-man
Pull Requests are welcomed as long as they are properly justified and there are no conflicts. If your PR has something to do with the README or in general related with the documentation, I'll gladly merge it! Also, when writing code for the project you must use the .editorconfig file on your editor so as to "maintain consistent coding styles". For instructions on how to use this file refer to EditorConfig's website.
Things I currently need help on:
The following projects inspired the creation of AbbrevMan.nvim. If possible, go check them out to see why they are so amazing :]
AbbrevMan.nvim is released under the GPL v3.0 license. It grants open-source permissions for users including:
For more convoluted language, see the LICENSE file.
High Priority
Low Priority