diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-07-30 15:09:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-30 15:09:19 -0400 |
| commit | 6cdab150bc161a35ca6356a4d1b4add17c52eb4b (patch) | |
| tree | ad9defc4e83dd02fd5fc97c40fb550288abf6fa5 /runtime/lua/vim/fs.lua | |
| parent | a7f422fa484b41f4999e340db1c97bfc78cbee24 (diff) | |
| download | rneovim-6cdab150bc161a35ca6356a4d1b4add17c52eb4b.tar.gz rneovim-6cdab150bc161a35ca6356a4d1b4add17c52eb4b.tar.bz2 rneovim-6cdab150bc161a35ca6356a4d1b4add17c52eb4b.zip | |
docs: misc #41063
Diffstat (limited to 'runtime/lua/vim/fs.lua')
| -rw-r--r-- | runtime/lua/vim/fs.lua | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index 57e0da4650..1c48944807 100644 --- a/runtime/lua/vim/fs.lua +++ b/runtime/lua/vim/fs.lua @@ -191,8 +191,7 @@ end --- (default: `false`) --- @field follow? boolean --- ---- Normalize {path} via |vim.fs.normalize()|. Set `false` to use {path} literally, e.g. to list a ---- directory whose name contains `~` or `$`. +--- Expand "~" and "$" in {path} before scanning the directory. --- (default: `true`) --- @field normalize? boolean @@ -678,10 +677,10 @@ end --- (default: `true` in Windows, `false` otherwise) --- @field win? boolean ---- Normalize a path to a standard format. A tilde (~) character at the beginning of the path is ---- expanded to the user's home directory and environment variables are also expanded. "." and ".." ---- components are also resolved, except when the path is relative and trying to resolve it would ---- result in an absolute path. +--- Normalize a path to a standard format. Expands environment variables, and tilde "~" at the +--- beginning of the path. Resolves "." and ".." components, except when the path is relative and +--- resolving it would produce an absolute path. +--- --- - "." as the only part in a relative path: --- - "." => "." --- - "././" => "." @@ -691,20 +690,20 @@ end --- - ".." in the root directory returns the root directory. --- - "/../../" => "/" --- ---- On Windows, backslash (\) characters are converted to forward slashes (/). +--- On Windows, backslashes (`\`) are converted to forward slashes (`/`). --- --- Examples: ---- ``` ---- [[C:\Users\jdoe]] => "C:/Users/jdoe" ---- "~/src/neovim" => "/home/jdoe/src/neovim" ---- "$XDG_CONFIG_HOME/nvim/init.vim" => "/Users/jdoe/.config/nvim/init.vim" ---- "~/src/nvim/api/../tui/./tui.c" => "/home/jdoe/src/nvim/tui/tui.c" ---- "./foo/bar" => "foo/bar" ---- "foo/../../../bar" => "../../bar" ---- "/home/jdoe/../../../bar" => "/bar" ---- "C:foo/../../baz" => "C:../baz" ---- "C:/foo/../../baz" => "C:/baz" ---- [[\\?\UNC\server\share\foo\..\..\..\bar]] => "//?/UNC/server/share/bar" +--- ```lua +--- [[C:\Users\jdoe]] --> "C:/Users/jdoe" +--- "~/src/neovim" --> "/home/jdoe/src/neovim" +--- "$XDG_CONFIG_HOME/nvim/init.vim" --> "/Users/jdoe/.config/nvim/init.vim" +--- "~/src/nvim/api/../tui/./tui.c" --> "/home/jdoe/src/nvim/tui/tui.c" +--- "./foo/bar" --> "foo/bar" +--- "foo/../../../bar" --> "../../bar" +--- "/home/jdoe/../../../bar" --> "/bar" +--- "C:foo/../../baz" --> "C:../baz" +--- "C:/foo/../../baz" --> "C:/baz" +--- [[\\?\UNC\server\share\foo\..\..\..\bar]] --> "//?/UNC/server/share/bar" --- ``` --- ---@since 10 |