![Ubuntu WSL 中基本文本编辑器的替代品](https://linux22.com/image/1164358/Ubuntu%20WSL%20%E4%B8%AD%E5%9F%BA%E6%9C%AC%E6%96%87%E6%9C%AC%E7%BC%96%E8%BE%91%E5%99%A8%E7%9A%84%E6%9B%BF%E4%BB%A3%E5%93%81.png)
目前我有一个从 MS 商店下载的 ubuntu 终端。我希望能够在不使用 nano/vim/emacs 的情况下编辑代码。这可能吗?我可以使用 Visual Studio 等外部编辑器吗?
答案1
WSL-OPEN 赢得胜利!!
https://github.com/4U6U57/wsl-open
在 WSL 中,将默认编辑器设置为 WSL-OPEN:
导出编辑器=wsl-open
这会自动将文件转换为与 EXT 相关的默认 Windows 应用程序。
答案2
我遇到了这个问题,MS Visual Studio Code 非常擅长解决这个问题。安装它,然后运行“code .”,它就会打开。下面有更详细的说明。
https://code.visualstudio.com/remote-tutorials/wsl/run-in-wsl
答案3
您询问的是 Ubuntu/WSL 下的代码编辑器。
您可能需要文本应用程序或图形应用程序。并且您需要指定代码使用的语言。
如果你使用 Eclipse,那么这个可能会有用
https://stackoverflow.com/questions/39670891/eclipse-cc-project-on-bash-on-ubuntu-on-windows
https://www.cs.odu.edu/~zeil/FAQs/Public/win10Bash/#installing-eclipse
对于 Netbeans
http://web.cse.msstate.edu/~crumpton/reference/Installing_NetBeans_IDE_for_use_with_WSL.pdf
否则,这可能会有帮助
https://cepa.io/2018/02/20/linuxizing-your-windows-pc-part2/
答案4
- 下载适用于 Windows 的 Visual Studio Code
- 在 ubuntu 终端中输入“code <要打开的文件/文件夹的路径>”。
示例:
code ./codes_folder
code ./codes_folder/1.c
- 如果您想使用任何其他编辑器,请使用适当的命令而不是代码。