文章目录
- 0.安装
- 1.配置中文
- 2.插件(推荐使用)
- 字体设置
- 6.字符显示配置
- 自定义颜色配置
- 8.环境变量:terminal runner问题
- 9.复制root用户vscode插件配置
- 10.单步调试
- 11.快捷键
- 12.文件比较
- 自带terminal:Could not connect to display
- 14.列编辑
- 15. update
- 16. 关闭/开启代码缩略图
- 17. 根据不同文件类型设置诸如tab的长度,insertSpace使能,ruler位置等选项
- 18. sync settings配置
- 19. emoji使用
- 20. Netease cloudmusic使用
- 21. 自定义配色
- 其它
- 问题
- 1 vscode启动react出现System limit for number of file watchers reached, watch
VSCode使用之后,瞬间就爱上了此款编辑器
0.安装
在Ubuntu软件中心,直接搜索Visual Studio Code
传送门
# offline
sudo dpkg -i code_1.25.1-1531323788_amd64.deb
#sudo apt --fix-broken install ./code_1.25.1-1531323788_amd64.deb
# online
wget -q /keys/ -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] /repos/vscode stable main"
sudo apt update
sudo apt install code
code #打开vscode软件
1.配置中文
参考:/hellozex/article/details/80763558
或者
安装简体中文插件
Chinese (Simplified) Language Pack for Visual Studio Code
2.插件(推荐使用)
参考:
/maixiaochai/article/details/90767129
/zzsdream/p/
/sybboy/p/
插件名称:
Python
python snippets
Word Count CJK #文字统计
Sort lines
Better Align
vscode-pdf
vscode-icons
Material Icon Theme #推荐
Settings Sync #推荐
SVG 推荐
SVG Viewer (不推荐,有bug)
Code Spell Checker
path-intellisense
Bracket Pair Colorizer
Todo Tree
Indent-Rainbow
Code Runner
python snippets
python test使用参考:/anguuan/article/details/104782857
filesize
leetCode
Markdown+Math #latex专业公式插件
Markdown All in One #设置Markdown › Extension › Math: Enabled ->不够选Enable basic math support (Powered by KaTeX).,会选用Markdown+Math专业公式
markdownlint
Foam #markdown写书插件
Markdown Preview Enhanced
Markdown PDF #将markdown文档成才pdf格式文档
Markdown TOC #自动生成目录安装使用教程参考
markdown画图插件 Mermaid各种类型的画图
使用问题参考
Hex Editor #vs code 以16进制格式查看文件
打开用户设置之后在搜索设置里面搜索Eol。
找到文件的Eol可以看到默认行尾字符设置为auto --> 改成 \n 即可 自动生成目录不对齐问题。
#md转pdf依赖包
sudo apt-get install calibre #功能ebook->PDF
#ubuntu18 install chrome #功能Chrome
/linux/direct/google-chrome-stable_current_amd64.deb #下载
sudo apt install ./google-chrome-stable_current_amd64.deb #安装
md文件画流程图,推荐使用dot画图
md文件内容如下
···dot #注意 ...替换为```字符
digraph NetFlow {
Left->FeatureL[label=FeatureNet];
Right->FeatureR[label=FeatureNet];
{FeatureL,FeatureR}->CostVolume[style=bold,color=red];
edge [color=blue];
CostVolume->Aggregation;
Aggregation->Estimation;
Estimation->Refinement
Refinement->Disp;
Refinement[shape=box,fontcolor=red];
Disp[color=red];
}
···
Git History
GitLens — Git supercharged
Material Theme
Slack Theme #推荐
Tiny Light #推荐 护眼(绿色为主),其它都是黑色主题,时间长了容易眼痛
Peacock # 推荐 可以随机产生不同颜色的主题
#推荐使用方法:Tiny Light为主色调,Peacock为辅助色调(peacock:Surprise Me With Random Color)
Matlab
Matlab Code Run
Matlab Snippets
matlab-formatter
Emoji Code
#完美文档工具
Latex
#参考 Ubuntu 18.04配置latex+VS code
/u014454538/article/details/104501611
编译.tex文件->pdf Ctrl+Alt+B
vscode 配置如下
"": [
{
"name": "xelatex",
"tools": ["xelatex"]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": ["xelatex", "bibtex", "xelatex", "xelatex"]
}
],
"": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": ["%DOCFILE%"]
}
],
"": "xelatex",
"": "tab"
latex+vscode其他配置:/liu6tot/article/details/104243625
vscode SSH #推荐 config参考
安装如下插件
Remote-SSH
Remote-SSH:Editing Configuration Files
配置如下:
vim ~/.ssh/config
#写入
Host 1080ti
HostName 192.168.
User username
即可直接使用,连接过程中需要输入ssh登陆的password
PlantUML #画图插件,系统环境依赖,java安装包:sudo apt-get install openjdk-8-jdk
Graphviz Preview 依赖插件
Integration #推荐, 有了此插件,基本功能上可以和visio拜拜了
将 VS Code 打造成一个体验舒适的 Markdown 编辑器
File->Preference->Python: Conda Path:/home/$(user-name)/miniconda3
- 1 插件 matlab
- 2 settings
-vscode -> File -> preferences -> search word: matlab
Matlab: Matlabpath
/usr/local/MATLAB/R2018a/bin/matlab
Matlab: Mlintpath
/usr/local/MATLAB/R2018a/bin/glnxa64/mlint - 3 插件 matlab-formatter
用于整理规范matlab代码
字体设置
系统安装fira字体
# ubuntu18
sudo apt-get update
sudo apt-get install fonts-firacode
# windows10 on power shell 管理员
#Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object ).DownloadString('/install.ps1'))
choco install firacode
File->Preference->Text Editor->Font
"": "Fira Code",//后边的引号中写上要设置的字体类型,个人比较喜欢Fira Code
"": true,//这个控制是否启用字体连字,true启用,false不启用,这里选择启用
"": 14,//设置字体大小
"": "normal",//这个设置字体粗细,可选normal,bold,"100"~"900"等,选择合适的就行
6.字符显示配置
一直显示空格符号
File->Preference->Editor: Render Whitespace:all
改成false目的是:不要检测到第一个是tab,就后面都用tab,这样会覆盖默认设置。
Editor: Detect Indentation: false,
显示tab符
Editor: Render Control Characters: yes
自定义颜色配置
参考:/p/20311e5dc104
"": {
// "": "#1f1f2c",
// "": "#1d1f2e"
"":"#FFFFFF",
"":"#333333",
"":"#333333",
"":"#333333",
"":"#FFFFFF",
"":"#795DA3",
"":"#969896",
"":"#795DA3",
"":"#183691",
"":"#183691",
"":"#A71D5D",
"":"#ED6A43",
"":"#FFFFFF",
"":"#795DA3",
"":"#183691",
"":"#183691",
"":"#A71D5D",
"":"#ED6A43",
"":"#333333",
"":"#795DA3"
},
其它配色方案:
/vscode-base16-term/#/
个人喜好:Material 系列配色方案
8.环境变量:terminal runner问题
code runner 使用是出现
[Running] python -u "/home/tt01/work/dbsr/"
/bin/sh: 1: python: not found
[Done] exited with code=127 in 0.011 seconds
问题背景:conda python + vscode + code runner
解决方式:现在终端上激活conda python环境,然后是终端输入code命令(打开vscode)
9.复制root用户vscode插件配置
su xxx
cd
cp -r /home/root/.vscode .
10.单步调试
参考官网
参考官网Linux C++配置
参
Ubuntu下Vscode调试出现无法打开""
在gnu官网找到对应的glibc下载解压到/build/xxx对应文件中
参考:/p/4b905372cdc6
在c/c++项目下的.vscode目录,保证有如下文件:
- c_cpp_properties.json 配置头文件包含
- 配置运行环境
- 配置调试环境
- (可选)本工程的vscode自定义配置
c/c++ 文件内容如下
{
"version": "2.0.0",
// "tasks": [
// {
// "type": "cppbuild",
// "label": "C/C++: gcc build active file",
// // "command": "/usr/bin/gcc",
// "command": "make solution=debug",
// "args": [
// "-g",
// "${file}",
// "-o",
// "${fileDirname}/${fileBasenameNoExtension}"
// ],
// "options": {
// "cwd": "${workspaceFolder}"
// },
// "problemMatcher": [
// "$gcc"
// ],
// "group": {
// "kind": "build",
// "isDefault": true
// },
// "detail": "compiler: /usr/bin/gcc"
// }
// ]
"tasks": [
{
"label": "debug",
"type": "shell",
"command": "make", //shell 命令
"args": ["solution=debug"], //shell 命令参数, 需要配合makefile文件接口
"group": { //vscode Ctrl+Shift+B快捷键调出的快捷菜单
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc" ],
//关闭烦人的提示"Terminal will be reused by tasks, press any key to close it."
"presentation": {
"reveal": "silent",
"clear": true
}
},
{
"label": "release",
"type": "shell",
"command": "make",
"args": ["solution=release"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"],
"presentation": {
"reveal": "silent",
"clear": true
}
},
{
"label": "clean",
"type": "shell",
"command": "make",
"args": ["clean"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [ ],
"presentation": {
"reveal": "silent",
"clear": true
}
}
]
}
c/c++ 文件内容如下
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: /fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
// "program": "enter program name, for example ${workspaceFolder}/",
"program": "${workspaceFolder}/prj/", //可执行程序入口
// "args": [""], //可执行程序参数
"args": ["-l=0.141"], //可执行程序参数
"stopAtEntry": false,
"cwd": "${workspaceFolder}/prj", //起始位置
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
ctrl+shift+P打开Command Palette,运行C/Cpp: Edit configurations…生成c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include/",
"/usr/local/include/opencv4" //opencv路径
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu11",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
#编译
Ctrl+Shift+B
#调试
F5 or from the main menu choose Run > Start Debugging
python 文件配置不需要,需要 文件配置,如下
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: /fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
11.快捷键
官方参考
参考
12.文件比较
参考:/qq_41151638/article/details/79650141
自带terminal:Could not connect to display
解决方法
#解决方案很简单:
export DISPLAY=':0.0'
#如果不行的话则尝试
export DISPLAY=':1.0'或export DISPLAY=':2.0'
#至于何时为1.0或2.0或0.0,可以在终端执行:
echo ${DISPLAY}
#显示的是什么配置成什么就行了
#启动时自动设置,如下修改配置文件
vim ~/.bashrc
export DISPLAY=':0.0'
14.列编辑
参考博客
-
多光标插入功能
Alt+鼠标左键,添加多光标输入 #only windows - 列选择
Shift+Alt+鼠标左键拖动,选中拖动的区域内容 #windows+linux
15. update
避免每次去官方下载手动安装的麻烦
wget /latest/linux-deb-x64/stable -O ~/Downloads/code_latest_amd64.deb
sudo dpkg -i ~/Downloads/code_latest_amd64.deb
16. 关闭/开启代码缩略图
vsCode配置代码缩略图:
文件–>首选项–>设置–>搜索 minimap --> true 打开 false 关闭
17. 根据不同文件类型设置诸如tab的长度,insertSpace使能,ruler位置等选项
"[C_CPP]": {
"": 4,
"": true
},
"[Makefile]": {
"": 4,
"": false
},
18. sync settings配置
- 注册要有github账户
- github -> New gist -> create: 把gist id号copy,以备后续使用
- github -> Settings -> Develop Settings -> Personal access tokens -> Generate new token: 把token字符串copy,以备后续使用
- vscode -> ctrl + shift + p -> sync: Advance option -> sync: open settings -> 把 gist id号和token字符串填写如对于位置 -> 回车
使用:
- 常服务器 vscode 填入gist + token -> sync: update/upload
- 其它服务器 vscode 填入 gist -> sync: Download
19. emoji使用
参考:在markdown中插入emoji表情
20. Netease cloudmusic使用
VSC Netease Music,找到插件,install即可
先登陆:建议手机号直接注册,随机秘密,然后登陆
ctrl+shift+p 输入 cloudmusic,点开start
21. 自定义配色
theme-color官网参考(非常详细)
建议关注: 的选项配置进行自定义配置,自定义配置内容写入即可,其它使用主题插件解决
Customize Colors in Global Setting示例
C/C++ Naming Conventions所有自定义支持类型
其它
在线文档:/note/
问题
1 vscode启动react出现System limit for number of file watchers reached, watch
参考
需要在vscode下修改文件监控数
解决 bug System limit for number of file watchers reached, watch
sudo vi /etc/
# 在最后面加入
.max_user_watches=524288
# 保存后推出
# 之后运行命令
sudo sysctl -p