Merge pull request #29625 from zeertzjq/backport

Backport to release-0.10
This commit is contained in:
zeertzjq
2024-07-09 19:45:31 +08:00
committed by GitHub
3 changed files with 12 additions and 10 deletions

View File

@ -50,11 +50,11 @@ local function check_config()
local init_lua = vim.fn.stdpath('config') .. '/init.lua'
local init_vim = vim.fn.stdpath('config') .. '/init.vim'
local vimrc = vim.env.MYVIMRC and vim.fn.expand(vim.env.MYVIMRC) or init_lua
local vimrc = vim.env.MYVIMRC and vim.fs.normalize(vim.env.MYVIMRC) or init_lua
if vim.fn.filereadable(vimrc) == 0 and vim.fn.filereadable(init_vim) == 0 then
ok = false
local has_vim = vim.fn.filereadable(vim.fn.expand('~/.vimrc')) == 1
local has_vim = vim.fn.filereadable(vim.fs.normalize('~/.vimrc')) == 1
health.warn(
('%s user config file: %s'):format(
-1 == vim.fn.getfsize(vimrc) and 'Missing' or 'Unreadable',
@ -114,7 +114,7 @@ local function check_config()
)
shadafile = (
vim.o.shadafile == ''
and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fn.expand(
and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fs.normalize(
shadafile
))
or (vim.o.shadafile == 'NONE' and '' or vim.o.shadafile)

View File

@ -77,12 +77,14 @@ local function download(url)
return out
end
elseif vim.fn.executable('python') == 1 then
local script = "try:\n\
from urllib.request import urlopen\n\
except ImportError:\n\
from urllib2 import urlopen\n\
response = urlopen('" .. url .. "')\n\
print(response.read().decode('utf8'))\n"
local script = ([[
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
response = urlopen('%s')
print(response.read().decode('utf8'))
]]):format(url)
local out, rc = health.system({ 'python', '-c', script })
if out == '' and rc ~= 0 then
return 'python urllib.request error: ' .. rc

View File

@ -136,7 +136,7 @@ function M.open(path)
})
local is_uri = path:match('%w+:')
if not is_uri then
path = vim.fn.expand(path)
path = vim.fs.normalize(path)
end
local cmd --- @type string[]