Featured image of post 在VsCode中使用PicGo插件

在VsCode中使用PicGo插件

前言

在完成这篇 《利用GitHub作为图床并中转加速》 的操作后,我希望还能用更快的方式在Vscode中插入图片。本次操作在Windows 11完成。

配置

打开VsCode,进入拓展商店。

安装插件

在搜索框中输入:

picgo

找到开发者为PicGo的插件,然后安装。

设置插件

点击插件的⚙️图标,在弹出的菜单里选择设置
找到Config PathData Path两处配置。

根据插件作者的说明vs-picgo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
// Windows
{
    "picgo.configPath":"YOUR_HOME_DIR\\AppData\\Roaming\\PicGo\\data.json",
    "picgo.dataPath": "YOUR_HOME_DIR\\AppData\\Roaming\\PicGo\\data.json"
}

// macOS
{
    "picgo.configPath": "YOUR_HOME_DIR/Library/Application Support/picgo/data.json",
    "picgo.dataPath": "YOUR_HOME_DIR/Library/Application Support/picgo/data.json"
}

// Linux
{
    "picgo.configPath": "YOUR_HOME_DIR/.config/picgo/data.json",
    "picgo.dataPath": "YOUR_HOME_DIR/.config/picgo/data.json"
}

也就说,Config PathData Path的内容要写成:

C:\Users\你的用户名\AppData\Roaming\picgo\data.json

例如:C:\Users\ikun\AppData\Roaming\picgo\data.json
填写完毕后可以直接关闭页面,插件会自动保存配置。

测试

关于快捷键,根据插件作者的说明vs-picgo

OSUploading an image from clipboardUploading images from explorerUploading an image from input box
Windows/UnixCtrl + Alt + UCtrl + Alt + ECtrl + Alt + O
OsXCmd + Opt + UCmd + Opt + ECmd + Opt + O

也就是说,把图片复制后,Windows11可以在VsCode的md文件编辑界面里按下Ctrl + Alt + U,那么插件就会自动将你所复制的图片上传到服务器。
上传成功后,插件会自动插入markdown格式的图片名和图片链接。