使用vim编辑文件不是很顺手, 利用 vscode 插件实现本地编辑远程文件
安装 Remote VSCode
- 打开 marketplace, 点击
Install
, 安装后重启vsc
- 按照 bash rmate 文档, 在 远程服务器 上 安装 rmate
1
2sudo wget -O /usr/local/bin/rmate https://raw.github.com/aurora/rmate/master/rmate
sudo chmod a+x /usr/local/bin/rmate
使用
- 在本机
vscode
窗口中, 按键F1
, 输入Remote: Start server
, 回车后启动Remote VSCode
服务 - 在命令行中输入
ssh -R 52698:127.0.0.1:52698 user@example.com -p ssh_port
- 在命令行中输入
rmate file
配置
在 配置vscode
中 打开 User Setttings
, 搜索 remote vscode
修改相关配置
参考文档
- marketplace remote-vscode
- Remote File Editing Over SSH with Visual Studio Code
- Editing files in your Linux Virtual Machine made a lot easier with Remote VSCode
文章若有纰漏请大家补充指正,谢谢!