It seems that vim does not work correctly when editing files in Windows systems directories. For example, editing the PowerShell all users, all hosts profile script fails. The current file has only one (1) line in it.
C:>Get-Content C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
Write-Host "$($PSVersionTable.PSVersion.ToString()) All Users, All Hosts @ $($MyInvocation.MyCommand.Source)"
I use vim to add one line.
1 asdf
2 Write-Host "$($PSVersionTable.PSVersion.ToString()) All Users, All Hosts @ $($MyInvocation.MyCommand.Source)"
After saving and exiting vim, the file remains unchanged.
C:>Get-Content C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
Write-Host "$($PSVersionTable.PSVersion.ToString()) All Users, All Hosts @ $($MyInvocation.MyCommand.Source)"
Yet, when I run vim on the file again, it appears with the line I added.
1 asdf
2 Write-Host "$($PSVersionTable.PSVersion.ToString()) All Users, All Hosts @ $($MyInvocation.MyCommand.Source)"
I do not see any information about the file being read-only. Using Ctrl-G only presents the expected "profile.ps1" line 1 of 2 --50%-- col 1.
If I start the shell as Administrator and edit the file, it appears to be empty.
1
I am using C:>vim --version VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 6 2016 17:05:36)
/Program Files (x86)or/Program Files(or neither)? I think most people run the 32-bit version as it's recommended (uses less memory for one). If so there's not much Vim could do about this issue. BTW, thanks for accepting my answer and please upvote, too, if you didn't intentionally skip that. Hate to see an extra 10 points go to waste as I try to get to 750. :) – B Layer Sep 25 '17 at 00:26