我刚刚安装了 gVim,并尝试使用通常适用于 linux 的常用“vim myfile.java”技术来打开文件并对其进行编辑。但不幸的是,这似乎不起作用。我也试过“gvim myfile.java”,但这也不起作用。
有谁知道如何使用 Windows Powershell 或其他一些技术打开 vim(并像在 linux 中一样使用它)?
Red*_*ick 10
我通过单击桌面上的图标或使用 Windows 资源管理器上下文菜单中的“使用 vim 编辑”来运行 gVim。
如果要从 Windows 命令提示符调用 vim,则需要将 vim.exe 的路径添加到 %PATH% 或键入完整路径(例如 "c:\program Files\gvim\vim9.9\vim.exe" foo.txt
小智 9
获取Gvim 可执行文件并安装在所需的系统上。
首先,打开 Power shell 并为规范化命令设置别名(Windows 7 及更高版本):
$ Set-alias vi "\path\to\gvim.exe"
$ Set-alias vim "\path\to\gvim.exe"
Run Code Online (Sandbox Code Playgroud)
答案涉及需要将vim包含vim.exe可执行文件的目录添加到路径的这一点。
但是对于那些需要更明确指示的人,请遵循这些程序。
1. Open Control Panel
2. Go to System
3. Click on Advanced system settings
4. In the Advanced tab, click on Environment Variables
5. Highlight Path in System variables and click Edit...
6. At the end, enter a semicolon and add the full directory as text
- for example, C:\Program Files (x86)\Vim\vim74
- note that this directory must contain the executable you want to execute in command prompt i.e. vim.exe
7. Click OK and exit
8. Open new command prompt session and run vim by typing the name of the executable
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
81298 次 |
| 最近记录: |