Compare commits

..
9 Commits
Author SHA1 Message Date
swaits 357580127c add github mirror 2024-01-29 10:23:27 -07:00
swaits c542d26de1 change reference packer to pckr.nvim 2023-10-26 09:09:48 -06:00
swaits 1977a65cb0 suggest lazy loading for lazy.vim instructions in README.md 2023-10-20 22:09:57 -06:00
swaits f61e0a1419 don't load config until setup() is called 2023-10-20 20:53:06 -06:00
swaits c00f1ae51e surface license in README.md 2023-10-20 10:54:41 -06:00
swaits 93f4128beb add screencast demo 2023-10-20 10:46:42 -06:00
swaits 9f327d4f0e README tweaks 2023-10-19 20:11:55 -06:00
swaits e1ce2a385f add .stylua.toml and fix indentation 2023-10-19 20:02:11 -06:00
swaits bc4d162b63 update README.md 2023-10-19 17:31:35 -06:00
5 changed files with 71 additions and 29 deletions

No files matched your search

+11
View File
@@ -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
+3
View File
@@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 100
+1 -1
View File
@@ -1,6 +1,6 @@
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
of this software and associated documentation files (the "Software"), to deal
+33 -5
View File
@@ -1,11 +1,15 @@
# thethethe
# thethethe.nvim
This is a Neovim plugin to autocorrect common misspellings and typos. If you
type _teh_, neovim will automatically correct it to _the_.
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
the dictionary in the background, so it doesn't delay startup time.
but designed for Neovim and written in pure Lua. It also loads the dictionary
in the background, so it doesn't delay startup time.
## Demo
[![asciicast](https://asciinema.org/a/WtUg846Z7wNiMrzPgjod1picV.svg)](https://asciinema.org/a/WtUg846Z7wNiMrzPgjod1picV)
## Installing
@@ -14,11 +18,13 @@ the dictionary in the background, so it doesn't delay startup time.
```lua
{
"https://git.sr.ht/~swaits/thethethe.nvim",
lazy = true,
event = "VeryLazy",
opts = { },
}
```
### [packer](https://github.com/wbthomason/packer.nvim)
### [pckr](https://github.com/lewis6991/pckr.nvim)
```lua
{
@@ -49,7 +55,29 @@ opts = {
## Future Directions
- Allow specifying a custom dictionary files
- Allow specifying custom dictionary files
- List custom dictionary entries directly in `opts {}`
- Split current (large!) dictionary into something like small, medium, large
- 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
View File
@@ -1,37 +1,37 @@
local M = {}
-- load our default configuration
local config = require("thethethe.config")
-- load abbreviations.dict
local function load_abbreviations()
-- load our dictionary string
local s = require("thethethe.dictionary")
-- load our dictionary string
local s = require("thethethe.dictionary")
-- split dictionary by lines
for line in s:gmatch("([^\n]*)\n?") do
-- split each line by the colon
local parts = {}
for part in line:gmatch("[^:]+") do
table.insert(parts, part)
end
-- split dictionary by lines
for line in s:gmatch("([^\n]*)\n?") do
-- split each line by the colon
local parts = {}
for part in line:gmatch("[^:]+") do
table.insert(parts, part)
end
if #parts == 2 and parts[1] and parts[2] then
-- Add abbreviation via `iabbrev` (through vim.cmd)
vim.cmd(string.format("iabbrev %s %s", parts[1], parts[2]))
end
end
if #parts == 2 and parts[1] and parts[2] then
-- Add abbreviation via `iabbrev` (through vim.cmd)
vim.cmd(string.format("iabbrev %s %s", parts[1], parts[2]))
end
end
end
-- create our exported setup() function
function M.setup(opts)
-- check for default overrides passed in
if opts then
config.delay_ms = opts.delay_ms or config.delay_ms
end
-- load our default configuration
local config = require("thethethe.config")
-- execute the function after config.delay_ms
vim.defer_fn(load_abbreviations, config.delay_ms)
-- check for default overrides passed in
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
return M