initial commit

This commit is contained in:
swaits committed 2023-10-19 17:20:30 -06:00
commit bbe5df14ae
5 files changed
+12550

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 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.
+47
View File
@@ -0,0 +1,47 @@
# thethethe
This is an autocorrect plugin for 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.
It defers loading the dictionary, so it doesn't delay startup time.
## Installing
### [lazy](https://github.com/folke/lazy.nvim)
```lua
{
"https://git.sr.ht/~swaits/thethethe.nvim",
opts = { },
}
```
### [packer](https://github.com/wbthomason/packer.nvim)
```lua
{
"https://git.sr.ht/~swaits/thethethe.nvim",
config = function()
require("thethethe").setup()
end
}
```
### [vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'https://git.sr.ht/~swaits/thethethe.nvim'
lua require("thethethe").setup()
```
## Configuring
The default configuration options are listed below:
```lua
require("thethethe").setup({
-- Time (milliseconds) to wait before loading abbreviations
delay_ms = 2000
})
```
+6
View File
@@ -0,0 +1,6 @@
local M = {}
-- Time (milliseconds) to wait before loading abbreviations
M.delay_ms = 2000
return M
File diff suppressed because it is too large. Load diff
+37
View File
@@ -0,0 +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")
-- 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
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
-- execute the function after config.delay_ms
vim.defer_fn(load_abbreviations, config.delay_ms)
end
return M