Skip to content

Commit

Permalink
Fix vim/env on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
notomo committed Aug 18, 2023
1 parent f9adae8 commit facbf09
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lua/cmdbuf/handler/vim/env.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ function M.new()
end

function M.histories()
local names = vim.fn.getcompletion("*", "environment")
local key_values = {}
for _, name in ipairs(names) do
local key_value = ("%s=%s"):format(name, os.getenv(name):gsub("\n", "\\n"))
table.insert(key_values, key_value)
local keys = vim.fn.getcompletion("*", "environment")
local lines = {}
for _, key in ipairs(keys) do
local value = vim.env[key]
if value then
local line = ("%s=%s"):format(key, value:gsub("\n", "\\n"))
table.insert(lines, line)
end
end
return key_values
return lines
end

function M.add_history(_, _) end
Expand Down

0 comments on commit facbf09

Please sign in to comment.