Skip to content

Commit

Permalink
updating
Browse files Browse the repository at this point in the history
  • Loading branch information
clpi committed Dec 1, 2024
1 parent 0dccb96 commit fe29008
Showing 1 changed file with 59 additions and 31 deletions.
90 changes: 59 additions & 31 deletions lua/word/config.lua
Original file line number Diff line number Diff line change
@@ -1,64 +1,92 @@
local sys = require("word.util.sys")
local C = {}
-- local defaults = require("word.config.default")
local os_info = sys.get_os_info()
local osi = require("word.util").get_os_info()
-- local wv = require("word.config.version")
local f = vim.fn

--- @alias word.config.init { config?: table }
--- @alias word.configuration.init { config?: table }

--- @class (exact) word.config.user
--- @class (exact) word.config.ft
--- @field md boolean
--- @field mdx boolean
--- @field markdown boolean

--- @class (exact) word.configuration.user
--- @field hook? fun(manual: boolean, arguments?: string) A user-defined function that is invoked whenever word starts up. May be used to e.g. set custom keybindings.
--- @field mods table<string, word.config.init> A list of mod to load, alongside their configs.
--- @field logger? word.log.config A config table for the logger.
--- @field lazy? boolean Whether to defer loading the word base until after the user has entered a `.word` file.
--- @field logger? word.log.configuration A configuration table for the logger.

--- @class (exact) word.config
--- @field arguments table<string, string> A list of arguments provided to the `:wordStart` function in the form of `key=value` pairs. Only applicable when
--- @field manual boolean? Used if word was manually loaded via `:wordStart`.
--- @field mod table<string, word.config.init> Acts as a copy of the user's config that may be modified at runtime.
--- @field word_version string The version of the file format to be used throughout word. Used internally.
--- @field os_info OperatingSystem The operating system that word is currently running under.
--- @class (exact) word.configuration
--- @field args table<string, string> A list of arguments provided to the `:wordStart` function in the form of `key=value` pairs. Only applicable when `user_config.lazy_loading` is `true`.
--- @field manual boolean? Used if word was manually loaded via `:wordStart`. Only applicable when `user_config.lazy_loading` is `true`.
--- @field mods table<string, word.configuration.init> Acts as a copy of the user's configuration that may be modified at runtime.
--- @field os OperatingSystem The operating system that word is currently running under.
--- @field pathsep "\\"|"/" The operating system that word is currently running under.
--- @field started boolean Set to `true` when word is fully initialized.
--- @field user word.config.user Stores the config provided by the user.
--- @field loaded boolean Set to `true` when word is fully initialized.
--- @field data string
--- @field user word.configuration.user Stores the configuration provided by the user.
--- @field version string The version of word that is currently active. Automatically updated by CI on every release.

--- Stores the configuration for the entirety of word.
--- This includes not only the user configuration (passed to `setup()`), but also internal

--- Stores the config for the entirety of word.
--- This includes not only the user config (passed to `setup()`), but also internal
--- variables that describe something specific about the user's hardware.
--- @see word.setup
---
--- @type word.config
C = {
--- @type word.configuration
C.config = {
user = {
mods = {
base = {}
}
},

store_path = f.stdpath("data") .. "/word.mpack",
data = f.stdpath("data") .. "/word.mpack",

mod = {},
manual = nil,
arguments = {},
---@type word.config.ft
ft = {
md = true,
mdx = true,
markdown = true,
},

-- word_version = wv.word_version,
-- version = wv.version,
word_version = "0.1.0",
mods = {},
manual = nil,
args = {},
version = "0.1.0",

os_info = os_info,
pathsep = os_info == "windows" and "\\" or "/",

os = osi,
pathsep = osi == "windows" and "\\" or "/",
hook = nil,
started = false,
loaded = false,
}

C.version = "0.1.0"
C.word_version = "0.1.0"

C.setup_telescope = function() end
C.n = function(k, c)
vim.api.nvim_set_keymap("n", k, c, { silent = true })
end
C.ni = function(k, c)
vim.keymap.set({ "n", "i" }, k, c, { silent = true })
end
C.setup_maps = function()
vim.api.nvim_set_keymap(
"n",
",wl",
"<CMD>Word lsp lens<CR>",
{ silent = true }
)
vim.api.nvim_set_keymap(
"n",
",wa",
"<CMD>Word lsp action<CR>",
{ silent = true }
)
end

C.setup_opts = function()
vim.o.conceallevel = 2
vim.o.concealcursor = [[nc]]
vim.o.shellslash = true
end
return C

0 comments on commit fe29008

Please sign in to comment.