aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-09 19:17:50 +0800
committerGitHub <noreply@github.com>2024-07-09 19:17:50 +0800
commit487f44a6c14f83a4f80a4d03a4a8c16ad690927a (patch)
treea6b9a3ee145bc0588940cda4852cd92528ce9ca0 /runtime
parentfb6c059dc55c8d594102937be4dd70f5ff51614a (diff)
downloadrneovim-487f44a6c14f83a4f80a4d03a4a8c16ad690927a.tar.gz
rneovim-487f44a6c14f83a4f80a4d03a4a8c16ad690927a.tar.bz2
rneovim-487f44a6c14f83a4f80a4d03a4a8c16ad690927a.zip
fix(lua): change some vim.fn.expand() to vim.fs.normalize() (#29583)
Unlike vim.fn.expand(), vim.fs.normalize() doesn't expand wildcards.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/lua/vim/health/health.lua6
-rw-r--r--runtime/lua/vim/ui.lua2
2 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/health/health.lua b/runtime/lua/vim/health/health.lua
index 235dacb82a..35b3ec17c4 100644
--- a/runtime/lua/vim/health/health.lua
+++ b/runtime/lua/vim/health/health.lua
@@ -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)
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
index ec5c5c5ba0..79638a044a 100644
--- a/runtime/lua/vim/ui.lua
+++ b/runtime/lua/vim/ui.lua
@@ -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[]