Compare commits
9
Commits
c87fc414c5
...
v0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
357580127c
|
||
|
|
c542d26de1
|
||
|
|
1977a65cb0
|
||
|
|
f61e0a1419
|
||
|
|
c00f1ae51e
|
||
|
|
93f4128beb
|
||
|
|
9f327d4f0e
|
||
|
|
e1ce2a385f
|
||
|
|
bc4d162b63
|
No files matched your search
+11
@@ -0,0 +1,11 @@
|
|||||||
|
image: alpine/edge
|
||||||
|
secrets:
|
||||||
|
- 88cce185-d2ec-4573-9546-e33f36f79bbf
|
||||||
|
sources:
|
||||||
|
- git+ssh://git@git.sr.ht/~swaits/thethethe.nvim
|
||||||
|
tasks:
|
||||||
|
- mirror-to-github: |
|
||||||
|
cd ~/thethethe.nvim
|
||||||
|
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
|
||||||
|
git remote add github git@github.com:swaits/thethethe.nvim.git
|
||||||
|
git push --mirror github
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
column_width = 100
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Stephen Waits <steve@waits.net>
|
Copyright © 2023 Stephen Waits <steve@waits.net>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
# thethethe
|
# thethethe.nvim
|
||||||
|
|
||||||
This is a Neovim plugin to autocorrect common misspellings and typos. If you
|
This is a Neovim plugin to autocorrect common misspellings and typos. If you
|
||||||
type _teh_, neovim will automatically correct it to _the_.
|
type _teh_, neovim will automatically correct it to _the_.
|
||||||
|
|
||||||
It's based on [vim-autocorrect](https://github.com/panozzaj/vim-autocorrect),
|
It's based on [vim-autocorrect](https://github.com/panozzaj/vim-autocorrect),
|
||||||
but designed for Neovim and written in pure Lua. Unlike that plugin, this loads
|
but designed for Neovim and written in pure Lua. It also loads the dictionary
|
||||||
the dictionary in the background, so it doesn't delay startup time.
|
in the background, so it doesn't delay startup time.
|
||||||
|
|
||||||
|
## Demo
|
||||||
|
|
||||||
|
[](https://asciinema.org/a/WtUg846Z7wNiMrzPgjod1picV)
|
||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
@@ -14,11 +18,13 @@ the dictionary in the background, so it doesn't delay startup time.
|
|||||||
```lua
|
```lua
|
||||||
{
|
{
|
||||||
"https://git.sr.ht/~swaits/thethethe.nvim",
|
"https://git.sr.ht/~swaits/thethethe.nvim",
|
||||||
|
lazy = true,
|
||||||
|
event = "VeryLazy",
|
||||||
opts = { },
|
opts = { },
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### [packer](https://github.com/wbthomason/packer.nvim)
|
### [pckr](https://github.com/lewis6991/pckr.nvim)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
{
|
{
|
||||||
@@ -49,7 +55,29 @@ opts = {
|
|||||||
|
|
||||||
## Future Directions
|
## Future Directions
|
||||||
|
|
||||||
- Allow specifying a custom dictionary files
|
- Allow specifying custom dictionary files
|
||||||
- List custom dictionary entries directly in `opts {}`
|
- List custom dictionary entries directly in `opts {}`
|
||||||
- Split current (large!) dictionary into something like small, medium, large
|
- Split current (large!) dictionary into something like small, medium, large
|
||||||
- Recategorize current dictionary "English" and add options to include non-English dictionaries
|
- Recategorize current dictionary "English" and add options to include non-English dictionaries
|
||||||
|
|
||||||
|
## MIT License
|
||||||
|
|
||||||
|
Copyright © 2023 Stephen Waits <steve@waits.net>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
+23
-23
@@ -1,37 +1,37 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
-- load our default configuration
|
|
||||||
local config = require("thethethe.config")
|
|
||||||
|
|
||||||
-- load abbreviations.dict
|
-- load abbreviations.dict
|
||||||
local function load_abbreviations()
|
local function load_abbreviations()
|
||||||
-- load our dictionary string
|
-- load our dictionary string
|
||||||
local s = require("thethethe.dictionary")
|
local s = require("thethethe.dictionary")
|
||||||
|
|
||||||
-- split dictionary by lines
|
-- split dictionary by lines
|
||||||
for line in s:gmatch("([^\n]*)\n?") do
|
for line in s:gmatch("([^\n]*)\n?") do
|
||||||
-- split each line by the colon
|
-- split each line by the colon
|
||||||
local parts = {}
|
local parts = {}
|
||||||
for part in line:gmatch("[^:]+") do
|
for part in line:gmatch("[^:]+") do
|
||||||
table.insert(parts, part)
|
table.insert(parts, part)
|
||||||
end
|
end
|
||||||
|
|
||||||
if #parts == 2 and parts[1] and parts[2] then
|
if #parts == 2 and parts[1] and parts[2] then
|
||||||
-- Add abbreviation via `iabbrev` (through vim.cmd)
|
-- Add abbreviation via `iabbrev` (through vim.cmd)
|
||||||
vim.cmd(string.format("iabbrev %s %s", parts[1], parts[2]))
|
vim.cmd(string.format("iabbrev %s %s", parts[1], parts[2]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- create our exported setup() function
|
-- create our exported setup() function
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
-- check for default overrides passed in
|
-- load our default configuration
|
||||||
if opts then
|
local config = require("thethethe.config")
|
||||||
config.delay_ms = opts.delay_ms or config.delay_ms
|
|
||||||
end
|
|
||||||
|
|
||||||
-- execute the function after config.delay_ms
|
-- check for default overrides passed in
|
||||||
vim.defer_fn(load_abbreviations, config.delay_ms)
|
if opts then
|
||||||
|
config.delay_ms = opts.delay_ms or config.delay_ms
|
||||||
|
end
|
||||||
|
|
||||||
|
-- execute the function after config.delay_ms
|
||||||
|
vim.defer_fn(load_abbreviations, config.delay_ms)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
Reference in new issue
Block a user