vscode下载
- 进入官网https://code.visualstudio.com/,根据自己电脑系统属性下载对应的版本
- 打开安装软件gui,一路点到尾即可,最后一页的勾选项,全部都勾上。
vscode开机必备插件
- IntelliCode
用于代码自动补全
- open in browser
用于html页面在浏览器中渲染
vscode配置markdown
安装插件,该插件可以体验即写即见的效果
vscode配置c++
reference:
- https://blog.youkuaiyun.com/m0_70885101/article/details/131154332
- https://zhuanlan.zhihu.com/p/147366852?tdsourcetag=s_pctim_aiomsg
1 下载mingw64
- 大神打包好的mingw安装exe
https://github.com/nixman/mingw-builds-binaries - 添加环境变量
2 安装插件
3 vscode配置文件
-
在项目文件夹内新建一个
.vscode
文件夹,里面新建三个json文件:c_cpp_properties.json
,launch.json
,tasks.json
。 -
tasks.json
,task是任务的意思,我们的编译和运行就是我们想要vscode执行的任务,为此我们要在tasks.json里写两个task:Build
和Run
(这里为什么不是Compile
呢?是因为从源码到可执行的过程中不仅是 编译(Compile) ,还有预编译、链接等过程,用 构建(Build) 来表述更合适)。除了编译和运行,我们还需要进行 调试(Debug) ,这个就不是通过task来实现的了,而是通过launch.json
文件来实现。-
c_cpp_properties.json
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.17763.0", "compilerPath": "D:\\Users\\16587\\mingw64\\bin\\g++.exe", /*bin目录下的g++.exe,两个反斜杠\\*/ "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "${default}" } ], "version": 4 }
-
launch.json
{ "version": "0.2.0", "configurations": [ { "name": "g++.exe build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\build\\${fileBasenameNoExtension}.exe", /*收纳exe可执行文件*/ "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "D:\\Users\\16587\\mingw64\\bin\\g++.exe", /*bin目录下的gdb.exe,两个反斜杠\\*/ "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "task g++" } ] }
-
tasks.json
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++.exe build active file", "command": "D:\\Users\\16587\\mingw64\\bin\\g++.exe", "args": [ "-fdiagnostics-color=always", "-g", "${file}", "-o", "${fileDirname}\\build\\${fileBasenameNoExtension}.exe" // exe改成存在build文件 ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "Task generated by Debugger." } ] }
-
-
cpp文件同目录下建了一个build文件夹存在exe文件
vscode配置git
安装git
- 进入官网下载git
https://git-scm.com/download/win - 安装一路点到尾
git连接github
reference:
- https://www.runoob.com/git/git-remote-repo.html
由于你的本地 Git 仓库和 GitHub 仓库之间的传输是通过SSH加密的,所以我们需要配置验证信息:
打开git bash
,使用以下命令生成 SSH Key:
$ ssh-keygen -t rsa -C "youremail@example.com"
后面的 your_email@youremail.com
改为你在 Github 上注册的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。
成功的话会在 ~/ 下生成 .ssh
文件夹,进去,打开 id_rsa.pub
,复制里面的 key。回到 github 上,进入 Account => Settings(账户配置)。左边选择 SSH and GPG keys,然后点击 New SSH key 按钮,title 设置标题,可以随便填,粘贴在你电脑上生成的 key。
为了验证是否成功,输入以下命令:
$ ssh -T git@github.com
vscode配置python
1 安装anaconda
- 进入官网下载安装即可https://www.anaconda.com/download#downloads
2 配置环境变量
…\anaconda(Python需要)
…\anaconda\Scripts(conda自带脚本)
…\anaconda\Library\mingw-w64\bin(使用C with python的时D:\Anaconda\Library\bin(jupyter notebook动态库)
3 安装插件
使用ipynb文件时,如果要将kernel设置成其他的conda环境,那么在其他的conda的环境中需要安装ipykernel
conda create -n your_env_name python==xx
conda activate your_env_name
pip install ipykernel
vscode配置java
vscode配置latex
reference:https://zhuanlan.zhihu.com/p/166523064
1 texlive卸载
-
找到
texlive\2019\tlpkg\installer
下的uninst.bat
文件并点击运行。 -
删除环境变量
2 texlive安装
- 打开https://tug.org/texlive/acquire-iso.html
- 点击
- 下载iso文件
下载完后安装即可。
安装TEX Live之后,安装后建议升级全部宏包,升级方法:使用cmd或terminal运行tlmgr update --all,如果tlmgr需要更新,请使用cmd运行tlmgr update --self,如果更新过程中出现了中断,请改用tlmgrupdate --self --all --reinstall-forcibly-removed更新
3 latex插件 latex workshop
-
在vscode 拓展应用
install
latex workshop -
设置json文件:vscode
setting
选项,点击右上角的open settings(JSON)
-
在json文件加入一下代码:
{
"latex-workshop.latex.autoBuild.run": "never",
"latex-workshop.showContextMenu": true,
"latex-workshop.intellisense.package.enabled": true,
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "XeLaTeX",
"tools": [
"xelatex",
"xelatex"
]
},
{
"name": "PDFLaTeX",
"tools": [
"pdflatex",
"pdflatex"
]
},
{
"name": "BibTeX",
"tools": [
"bibtex"
]
},
{
"name": "LaTeXmk",
"tools": [
"latexmk"
]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
],
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk"
],
"latex-workshop.latex.autoClean.run": "onFailed",
"latex-workshop.latex.recipe.default": "lastUsed",
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click"
}
4 代码和pdf双向定位
注意定位的tex代码文件和pdf文件要同名,否则无法定位
- 从pdf定位到代码:双击pdf需要定位的文字即可
- 从代码定位到pdf:更改快捷键,在vscode中更改以下两个选项的快捷键,这里我用ctrl+l
更改后,在需要定位的代码处使用快捷键即可定位为对应到pdf。
5 验证
- 在overleaf上下载一个latex项目
- 解压后,用vscode打开整个项目文件夹
- 通过以下步骤进行文件编译:
打开tex文件
–>点击左侧应用选项
–>点击recipe编译(笔者一般用xelatex或者latexmk)
–>若出现√则表示编译成功,出现×则表示编译失败
–>编译成功后删除临时文件