add .stylua.toml and fix indentation

This commit is contained in:
swaits committed 2023-10-19 20:02:11 -06:00
1 parent bc4d162b63
commit e1ce2a385f
2 files changed
+23 -20

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 100
+20 -20
View File
@@ -5,33 +5,33 @@ 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 -- check for default overrides passed in
if opts then if opts then
config.delay_ms = opts.delay_ms or config.delay_ms config.delay_ms = opts.delay_ms or config.delay_ms
end end
-- execute the function after config.delay_ms -- execute the function after config.delay_ms
vim.defer_fn(load_abbreviations, config.delay_ms) vim.defer_fn(load_abbreviations, config.delay_ms)
end end
return M return M