nvim: Always determine correct wrapping for wiki text files

For any files under my WIKIROOT directory I am sure that they are
textual (if they fall into the wrapping.nvim allowlist).
So we do not need to undertake the 'nontextual' file heuristic that uses
the capabilities of the language server connected. Especially since our
ZK lsp, or markdown lsp would always return the capability.

Unfortunately wrapping.nvim does not currently have the ability to
provide your own 'nontextual' heuristic, so I instead use a fork which
does and provide the correct function in the options.
This commit is contained in:
Marty Oehme 2025-08-23 12:38:45 +02:00
parent 943780c38b
commit c436fe66fd
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 33 additions and 6 deletions

View file

@ -100,7 +100,7 @@
"vim-spellsync": { "branch": "master", "commit": "ea9f431483ceb40ede8bd5b126a03eccd49b1bc0" }, "vim-spellsync": { "branch": "master", "commit": "ea9f431483ceb40ede8bd5b126a03eccd49b1bc0" },
"wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" }, "wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" },
"which-key.nvim": { "branch": "main", "commit": "fcbf4eea17cb299c02557d576f0d568878e354a4" }, "which-key.nvim": { "branch": "main", "commit": "fcbf4eea17cb299c02557d576f0d568878e354a4" },
"wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" }, "wrapping.nvim": { "branch": "feat/nontextual-detection-option", "commit": "f3eb5d36e518b62430fd705086bc83cf2b1e7ac2" },
"zen-mode.nvim": { "branch": "main", "commit": "04b52674b8c800f8b7d4609e8bd8d0212e3ffa79" }, "zen-mode.nvim": { "branch": "main", "commit": "04b52674b8c800f8b7d4609e8bd8d0212e3ffa79" },
"zk-nvim": { "branch": "main", "commit": "fd1ab2239ed85ca51051c094a49a280f4ed76bb2" } "zk-nvim": { "branch": "main", "commit": "fd1ab2239ed85ca51051c094a49a280f4ed76bb2" }
} }

View file

@ -1,7 +1,7 @@
-- append t2 to t1 -- append t2 to t1
-- happens in-place, so it CHANGES t1 -- happens in-place, so it CHANGES t1
local function concat(t1, t2) local function concat(t1, t2)
local tbl = {} local tbl = {}
for i = 1, #t1 do for i = 1, #t1 do
tbl[#tbl + 1] = t1[i] tbl[#tbl + 1] = t1[i]
end end
@ -85,14 +85,41 @@ local prose_plugs = {
}, },
}, },
{ {
"andrewferrier/wrapping.nvim", "marty-oehme/wrapping.nvim",
branch = "feat/nontextual-detection-option",
opts = { opts = {
create_keymaps = false, create_keymaps = false,
notify_on_switch = false, notify_on_switch = false,
-- softener = { quarto = true, markdown = true, text = true, asciidoc = true },
auto_set_mode_filetype_allowlist = prose_ft, auto_set_mode_filetype_allowlist = prose_ft,
softener = { quarto = 2.0, markdown = 2.0, djot = 2.0 },
nontextual_heuristic = function()
local nb = vim.tbl_get(vim.env, "ZK_NOTEBOOK_DIR") or vim.tbl_get(vim.env, "WIKIROOT")
if nb then
if vim.fn.expand("%:p:h"):find(nb) then
return false
end
return true
end
local get_clients
if vim.fn.has("nvim-0.10") == 1 then
get_clients = vim.lsp.get_clients
else
get_clients = vim.lsp.get_active_clients
end
for _, client in pairs(get_clients({ bufnr = 0 })) do
if
client.server_capabilities.definitionProvider
or client.server_capabilities.signatureHelpProvider
then
return true
end
end
return false
end,
}, },
-- event = { "BufReadPre", "BufNewFile" },
ft = prose_ft, ft = prose_ft,
keys = { keys = {
{ {
@ -114,7 +141,7 @@ local prose_plugs = {
}, },
}, },
{ {
-- displays prettier md rendering -- displays prettier md rendering
"MeanderingProgrammer/render-markdown.nvim", "MeanderingProgrammer/render-markdown.nvim",
opts = { opts = {
file_types = md_like, file_types = md_like,