-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: ~ symbol not treated as home when starting from CLI/terminal #23901
Comments
Your shell should be expanding |
Is that expanded by the shell? But vim could process with it. |
I'm pretty sure neovim should process the argument names verbatim on the command line. |
Yes, it didn't happen on WSL. |
vim special-cases this on Windows. That was removed in Nvim. You can force the special-casing by using the
|
Yes, it does get worked, but if nvim could treat this special case in windows, it will be better :) |
Does any other tool work like that on Windows? |
Powershell supports tilde expansion for built-in commands, and for native applications if you enable an experimental feature. But third party applications presumably have to implement it on their own. |
I didn't find yet. A similar situation occurs with wildcard symbol * in powershell :) |
I think "it would be better" is unarguable. But as lewis said, the responsibility of expanding symbols falls on the shell. And |
In PowerShell <= 7.3, the problem of tilde expansion is somewhat mitigated by tab expansion which automatically replaces the tilde with the absolute path to your home directory when you press Tab.
In PowerShell Core (7.4 in my case), Tab expansion autocompletes directories, but retains the tilde, and passes it unchanged in arguments.
See related PowerShell issue: PowerShell/PowerShell#20750. There is an experimental feature in the pre-release version of PowerShell 7.5 which performs ~ expansion at the shell level if enabled, but it's not enabled by default, and 7.5 is not yet released. It would be nice for Neovim to special-case ~ expansion on Windows at least until ~ expansion lands as a default feature in PowerShell. |
Thanks for that info. If powershell is gaining this feature then we definitely don't need to special case it. |
For what it's worth (and apologies for being late to the party) sublime handles the tilde expansion. However python does not handle the tilde expansion, so trying to run the following: And the direction of the slash ( |
It matters almost nowhere, except in a few specific, old console (cmd.exe) commands. |
In fix_fname() for MS-Windows, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory instead of a relative path to a literal "~" directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
I started working on a PR for this. I will put my notes from it here as well. PowerShell on Windows recently removed the feature where arguments such as What this means is, in PowerShell, when you run a command such as: nvim ~/.ssh/config , what happens is that nvim tries to open In these cases the user is very unlikely to want to open a file in literal nvim (gi ~/.ssh/config) , instead to get the file I want. There used to be an experimental feature for this in In the unreleased development version of PowerShell, which may not be released for quite a while yet, there is an experimental feature for this, I believe it would be better if we address this in neovim, because this PowerShell experimental feature will not be available for a while yet, and when it is it would require enabling it, and if this is done in neovim it would also work in WinPS ( I should also mention that the PowerShell completion behavior for tilde paths has also recently changed. Before, when you would type: nvim ~/.ssh/config<TAB> , it would expand to the absolute path, but PowerShell no longer expands tilde paths to absolute paths, it expands them to canonical tilde paths, leading to the behavior in neovim that I described. I tried to do this in |
Note that as of 2 days ago, |
In fix_fname() for MS-Windows, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory instead of a relative path to a literal "~" directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for WIN32, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for WIN32, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for MSWIN, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for MSWIN, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for MSWIN, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for MSWIN, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for MSWIN, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for MSWIN, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix #23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In command_line_scan() for MSWIN, expand "~\" or "~/" prefixed paths to the USERPROFILE environment variable for the user's profile directory. Fix neovim#23901 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Problem
any path including "~" cannot be operated correctly.
nvim ~/.vimrc
This doesn't work, and it will create a new file.
This get worked.
Steps to reproduce
just install neovim
and execute
nvim ~/.vimrc
Expected behavior
It should edit the
.vimrc
file instead of creating a new one.Neovim version (nvim -v)
0.9.1
Vim (not Nvim) behaves the same?
no, vim 9.0
Operating system/version
Windows 11
Terminal name/version
windows terminal 1.16.10262
$TERM environment variable
powershell
Installation
scoop
The text was updated successfully, but these errors were encountered: