- 前言
- 美化类插件
- 帮助开发类插件
- Docker
- 使用vscode优雅的编写Markdown
- Markdown实时预览
- Markdown贴图
- 其他配置
Author: 颖奇L’Amore
Blog: www.gem-love.com
MacOS高效使用文章合集:here
前言▸
我不是vscode的重度用户,平时基本是使用Goland IDEA之类的IDE写代码,vscode主要用来写小脚本(代码量较少)或者Markdown文档。
美化类插件▸
vscode-icons 可以给文件加图标
Atom One Light Theme 一个护眼主题 配置颜色:
代码语言:javascript复制{<span class="hljs-attr">"[Atom One Light]"</span>: {
<span class="hljs-attr">"editor.background"</span>: <span class="hljs-string">"#C7EDCC"</span>,
<span class="hljs-attr">"sideBar.background"</span>: <span class="hljs-string">"#C7EDCC"</span>,
<span class="hljs-attr">"activityBar.background"</span>: <span class="hljs-string">"#C7EDCC"</span>,
}
}
帮助开发类插件▸
- Auto Close Tag 自动添加HTML和XML的闭合标签
- Code Runner 一键运行代码
- GitHub Copilot 帮助你的AI补全代码 非常好用
- Highlight Matching Tag 配对的标签自动匹配
- open in browser 对于html等文件邮件点击open in browser直接浏览器打开
- Output Colorizer 对输出的日志高亮
- Sourcery 自动检测Python语法并可以优化
- TODO Highlight 对TODO和FIXME高亮
其中,Copilot需要登录GitHub才能使用 Code Runner我的配置:
代码语言:javascript复制{
<span class="hljs-attr">"files.associations"</span>: {
<span class="hljs-attr">"*.py"</span>: <span class="hljs-string">"python"</span>
},
<span class="hljs-attr">"code-runner.clearPreviousOutput"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"code-runner.saveAllFilesBeforeRun"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"code-runner.executorMap"</span>: {
<span class="hljs-attr">"javascript"</span>: <span class="hljs-string">"node"</span>,
<span class="hljs-attr">"java"</span>: <span class="hljs-string">"cd $dir && javac $fileName && java $fileNameWithoutExt"</span>,
<span class="hljs-attr">"c"</span>: <span class="hljs-string">"cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"cpp"</span>: <span class="hljs-string">"cd $dir && g $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"objective-c"</span>: <span class="hljs-string">"cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"php"</span>: <span class="hljs-string">"php"</span>,
<span class="hljs-attr">"python"</span>: <span class="hljs-string">"/usr/bin/python3 -u"</span>,
<span class="hljs-attr">"perl"</span>: <span class="hljs-string">"perl"</span>,
<span class="hljs-attr">"perl6"</span>: <span class="hljs-string">"perl6"</span>,
<span class="hljs-attr">"ruby"</span>: <span class="hljs-string">"ruby"</span>,
<span class="hljs-attr">"go"</span>: <span class="hljs-string">"go run"</span>,
<span class="hljs-attr">"lua"</span>: <span class="hljs-string">"lua"</span>,
<span class="hljs-attr">"groovy"</span>: <span class="hljs-string">"groovy"</span>,
<span class="hljs-attr">"powershell"</span>: <span class="hljs-string">"powershell -ExecutionPolicy ByPass -File"</span>,
<span class="hljs-attr">"bat"</span>: <span class="hljs-string">"cmd /c"</span>,
<span class="hljs-attr">"shellscript"</span>: <span class="hljs-string">"bash"</span>,
<span class="hljs-attr">"fsharp"</span>: <span class="hljs-string">"fsi"</span>,
<span class="hljs-attr">"csharp"</span>: <span class="hljs-string">"scriptcs"</span>,
<span class="hljs-attr">"vbscript"</span>: <span class="hljs-string">"cscript //Nologo"</span>,
<span class="hljs-attr">"typescript"</span>: <span class="hljs-string">"ts-node"</span>,
<span class="hljs-attr">"coffeescript"</span>: <span class="hljs-string">"coffee"</span>,
<span class="hljs-attr">"scala"</span>: <span class="hljs-string">"scala"</span>,
<span class="hljs-attr">"swift"</span>: <span class="hljs-string">"swift"</span>,
<span class="hljs-attr">"julia"</span>: <span class="hljs-string">"julia"</span>,
<span class="hljs-attr">"crystal"</span>: <span class="hljs-string">"crystal"</span>,
<span class="hljs-attr">"ocaml"</span>: <span class="hljs-string">"ocaml"</span>,
<span class="hljs-attr">"r"</span>: <span class="hljs-string">"Rscript"</span>,
<span class="hljs-attr">"applescript"</span>: <span class="hljs-string">"osascript"</span>,
<span class="hljs-attr">"clojure"</span>: <span class="hljs-string">"lein exec"</span>,
<span class="hljs-attr">"haxe"</span>: <span class="hljs-string">"haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt"</span>,
<span class="hljs-attr">"rust"</span>: <span class="hljs-string">"cd $dir && rustc $fileName && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"racket"</span>: <span class="hljs-string">"racket"</span>,
<span class="hljs-attr">"scheme"</span>: <span class="hljs-string">"csi -script"</span>,
<span class="hljs-attr">"ahk"</span>: <span class="hljs-string">"autohotkey"</span>,
<span class="hljs-attr">"autoit"</span>: <span class="hljs-string">"autoit3"</span>,
<span class="hljs-attr">"dart"</span>: <span class="hljs-string">"dart"</span>,
<span class="hljs-attr">"pascal"</span>: <span class="hljs-string">"cd $dir && fpc $fileName && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"d"</span>: <span class="hljs-string">"cd $dir && dmd $fileName && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"haskell"</span>: <span class="hljs-string">"runhaskell"</span>,
<span class="hljs-attr">"nim"</span>: <span class="hljs-string">"nim compile --verbosity:0 --hints:off --run"</span>,
<span class="hljs-attr">"lisp"</span>: <span class="hljs-string">"sbcl --script"</span>,
<span class="hljs-attr">"kit"</span>: <span class="hljs-string">"kitc --run"</span>,
<span class="hljs-attr">"v"</span>: <span class="hljs-string">"v run"</span>,
<span class="hljs-attr">"sass"</span>: <span class="hljs-string">"sass --style expanded"</span>,
<span class="hljs-attr">"scss"</span>: <span class="hljs-string">"scss --style expanded"</span>,
<span class="hljs-attr">"less"</span>: <span class="hljs-string">"cd $dir && lessc $fileName $fileNameWithoutExt.css"</span>,
<span class="hljs-attr">"FortranFreeForm"</span>: <span class="hljs-string">"cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"fortran-modern"</span>: <span class="hljs-string">"cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"fortran_fixed-form"</span>: <span class="hljs-string">"cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"</span>,
<span class="hljs-attr">"fortran"</span>: <span class="hljs-string">"cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"</span>
},
<span class="hljs-attr">"code-runner.runInTerminal"</span>: <span class="hljs-literal">true</span>,
<span class="hljs-attr">"python.defaultInterpreterPath"</span>: <span class="hljs-string">"/usr/bin/python3"</span>,
<span class="hljs-attr">"python.PythonPath"</span> : <span class="hljs-string">"/usr/bin/python3"</span>
}
Docker▸
Docker插件可以允许vscode直接访问并修改容器内的文件,或者attach shell进容器,启动镜像、容器等功能也是ok的,非常方便
使用vscode优雅的编写Markdown▸
Markdown实时预览▸
Markdown Preview Enhanced 插件允许实时预览Markdown
Markdown贴图▸
Paste Image插件允许你将图片直接复制进来,使用cmd option v
便会自动文件创建到当前目录下并自动帮助你写上相关md语法来引入该图
但是我平时都是直接将图片存到远程图床,我使用的是七牛云(也可以用其他很多图床,imgur 微博 gitee等都是免费的,uPic都支持),下载uPic配置好开机自启动和相应图床。然后给upload from clipboard加一个快捷键 例如我是shift cmd 8
然后把output format改为Markdown
这样想要将图片插入md只要先用截图工具截图(我用的snipaste),图片自动保存到剪切板,然后摁一下shift cmd 8上传到图床,此时上传后的结果自动保存到剪切板,再直接cmd v粘贴进来即可。当然,uPic的upload from screenshot更方便,直接截图 上传,设定一个快捷键(我是cmd shift 9)直接就可以,对于直接贴一个图进来是比较方便的,如果需要对图片进行加工(加文字框框等)还是用第三方截图工具然后upload from clipboard。
其他配置▸
经常vscode打开文件夹提示不信任文件夹,可以直接禁用该功能
代码语言:javascript复制{
<span class="hljs-attr">"security.workspace.trust.untrustedFiles"</span>: <span class="hljs-string">"open"</span>,
<span class="hljs-attr">"security.workspace.trust.enabled"</span>: <span class="hljs-literal">false</span>
}
vscode打开TERMINAL可能加载不出来powerlevel10k的图标,这时可以看一下iTerm用的什么字体
然后将字体加入Font Family
代码语言:javascript复制{
<span class="hljs-attr">"editor.fontFamily"</span>: <span class="hljs-string">"MesloLGS NF, Menlo, Monaco, 'Courier New', monospace"</span>
}