Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit aa884e3

Browse files
fix: inconsistencies
check if entry exists before updating and set linebreak by default if wrap is enabled
1 parent e3da040 commit aa884e3

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

lua/nvim-devdocs/operations.lua

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ M.install_args = function(args, verbose, is_update)
8989
local parsed = vim.fn.json_decode(content)
9090

9191
for _, arg in ipairs(args) do
92-
if is_update and not vim.tbl_contains(updatable, arg) then
93-
notify.log(arg .. " documentation is already up to date")
94-
else
95-
local slug = arg:gsub("-", "~")
96-
local data = {}
97-
98-
for _, entry in ipairs(parsed) do
99-
if entry.slug == slug then
100-
data = entry
101-
break
102-
end
92+
local slug = arg:gsub("-", "~")
93+
local data = {}
94+
95+
for _, entry in ipairs(parsed) do
96+
if entry.slug == slug then
97+
data = entry
98+
break
10399
end
100+
end
104101

105-
if vim.tbl_isempty(data) then
106-
notify.log_err("No documentation available for " .. arg)
102+
if vim.tbl_isempty(data) then
103+
notify.log_err("No documentation available for " .. arg)
104+
else
105+
if is_update and not vim.tbl_contains(updatable, arg) then
106+
notify.log(arg .. " documentation is already up to date")
107107
else
108108
M.install(data, verbose, is_update)
109109
end
@@ -218,6 +218,7 @@ M.open = function(entry, float)
218218
local win = vim.api.nvim_open_win(buf, true, float_opts)
219219

220220
vim.wo[win].wrap = plugin_config.wrap
221+
vim.wo[win].linebreak = plugin_config.wrap
221222
vim.wo[win].nu = false
222223
vim.wo[win].relativenumber = false
223224
end

0 commit comments

Comments
 (0)