Repository navigation
Expand file tree
/
Copy path.nvim.lua
More file actions
53 lines (45 loc) · 1.95 KB
/
Copy path.nvim.lua
File metadata and controls
53 lines (45 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- SPDX-FileCopyrightText: 2026 Kartoza
-- SPDX-License-Identifier: MIT
--
-- Project-local Neovim configuration.
--
-- The project has no node_modules, so a language server has to be pointed at
-- the pinned compiler explicitly. Everything else here is convenience.
local root = vim.fn.fnamemodify(vim.fn.resolve(vim.fn.expand("<sfile>:p")), ":h")
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.textwidth = 100
-- The vendored bundle and build output are never edited by hand.
vim.opt.wildignore:append({ "*/vendor/*", "*/js/*", "*/dist/*", "*/tools/typescript/*", "*/tests-build/*" })
local ok, lspconfig = pcall(require, "lspconfig")
if ok and lspconfig.ts_ls then
lspconfig.ts_ls.setup({
root_dir = function() return root end,
init_options = {
-- Use the compiler this project is pinned to, not whatever is on PATH.
tsserver = { path = root .. "/tools/typescript/lib" },
},
})
end
local function run(cmd, title)
return function()
vim.cmd("botright split | terminal " .. cmd)
vim.cmd("file " .. title)
end
end
local map = function(keys, fn, desc)
vim.keymap.set("n", "<leader>p" .. keys, fn, { desc = desc, buffer = false })
end
map("r", run("bin/dev.sh", "gd-dev"), "Run: watch-compile and serve")
map("b", run("bin/build.sh", "gd-build"), "Build: assemble dist/")
map("t", run("bin/test.sh", "gd-test"), "Test: run the unit tests")
map("c", run("bin/tsc.sh --noEmit -p tsconfig.json", "gd-check"), "Check: type check only")
map("d", run("mkdocs serve", "gd-docs"), "Docs: serve the mkdocs site")
map("f", run("bin/fetch-tools.sh", "gd-fetch"), "Fetch: restore the pinned toolchain")
map("k", run("pre-commit run --all-files", "gd-lint"), "Quality: the full pre-commit suite")
map("s", run("bin/sbom.sh", "gd-sbom"), "SBOM: print the bill of materials")
local ok_wk, wk = pcall(require, "which-key")
if ok_wk then
wk.add({ { "<leader>p", group = "project (Geometria Descritiva 10)" } })
end