文章目录
- 0.安装
- 1.配置中文
- 2.插件(推荐使用)
- 3.conda
- 4.matlab
- 5.fira字体设置
- 6.字符显示配置
- 7.terminal自定义颜色配置
- 8.环境变量:terminal runner问题
- 9.复制root用户vscode插件配置
- 10.单步调试
- 11.快捷键
- 12.文件比较
- 13.vscode自带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
传送门
sudo dpkg -i code_1.25.1-1531323788_amd64.deb
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
sudo apt update
sudo apt install code
code
1.配置中文
参考:https://blog.csdn.net/hellozex/article/details/80763558
或者
安装简体中文插件
Chinese (Simplified) Language Pack for Visual Studio Code
2.插件(推荐使用)
参考:
https://blog.csdn.net/maixiaochai/article/details/90767129
https://www.cnblogs.com/zzsdream/p/6592429.html
https://www.cnblogs.com/sybboy/p/8989342.html
插件名称:
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使用参考:https://blog.csdn.net/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
https://dl.google.com/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
https://blog.csdn.net/u014454538/article/details/104501611
编译.tex文件->pdf Ctrl+Alt+B
vscode setting.json配置如下
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": ["xelatex"]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": ["xelatex", "bibtex", "xelatex", "xelatex"]
}
],
"latex-workshop.latex.tools": [
{
"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%"]
}
],
"latex-preview.command": "xelatex",
"latex-workshop.view.pdf.viewer": "tab"
latex+vscode其他配置:https://blog.csdn.net/liu6tot/article/details/104243625
vscode SSH #推荐 config参考
安装如下插件
Remote-SSH
Remote-SSH:Editing Configuration Files
配置如下:
vim ~/.ssh/config
Host 1080ti
HostName 192.168.3.xxx
User username
即可直接使用,连接过程中需要输入ssh登陆的password
PlantUML #画图插件,系统环境依赖,java安装包:sudo apt-get install openjdk-8-jdk
Graphviz Preview 依赖插件
Draw.io Integration #推荐, 有了此插件,基本功能上可以和visio拜拜了
将 VS Code 打造成一个体验舒适的 Markdown 编辑器
3.conda
File->Preference->Python: Conda Path:/home/$(user-name)/miniconda3
4.matlab
- 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代码
5.fira字体设置
系统安装fira字体
sudo apt-get update
sudo apt-get install fonts-firacode
choco install firacode
File->Preference->Text Editor->Font
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 14,
"editor.fontWeight": "normal",
6.字符显示配置
一直显示空格符号
File->Preference->Editor: Render Whitespace:all
改成false目的是:不要检测到第一个是tab,就后面都用tab,这样会覆盖默认设置。
Editor: Detect Indentation: false,
显示tab符
Editor: Render Control Characters: yes
7.terminal自定义颜色配置
参考:https://www.jianshu.com/p/20311e5dc104
"workbench.colorCustomizations": {
"terminal.background":"#FFFFFF",
"terminal.foreground":"#333333",
"terminalCursor.background":"#333333",
"terminalCursor.foreground":"#333333",
"terminal.ansiBlack":"#FFFFFF",
"terminal.ansiBlue":"#795DA3",
"terminal.ansiBrightBlack":"#969896",
"terminal.ansiBrightBlue":"#795DA3",
"terminal.ansiBrightCyan":"#183691",
"terminal.ansiBrightGreen":"#183691",
"terminal.ansiBrightMagenta":"#A71D5D",
"terminal.ansiBrightRed":"#ED6A43",
"terminal.ansiBrightWhite":"#FFFFFF",
"terminal.ansiBrightYellow":"#795DA3",
"terminal.ansiCyan":"#183691",
"terminal.ansiGreen":"#183691",
"terminal.ansiMagenta":"#A71D5D",
"terminal.ansiRed":"#ED6A43",
"terminal.ansiWhite":"#333333",
"terminal.ansiYellow":"#795DA3"
},
其它配色方案:
https://glitchbone.github.io/vscode-base16-term/#/
个人喜好:Material 系列配色方案
8.环境变量:terminal runner问题
code runner 使用是出现
[Running] python -u "/home/tt01/work/dbsr/tempCodeRunnerFile.py"
/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调试出现无法打开"libc-start.c"
在gnu官网找到对应的glibc下载解压到/build/xxx对应文件中
参考:https://www.jianshu.com/p/4b905372cdc6
在c/c++项目下的.vscode目录,保证有如下文件:
- c_cpp_properties.json 配置头文件包含
- launch.json 配置运行环境
- tasks.json 配置调试环境
- settings.json (可选)本工程的vscode自定义配置
c/c++ tasks.json文件内容如下
{
"version": "2.0.0",
"tasks": [
{
"label": "debug",
"type": "shell",
"command": "make",
"args": ["solution=debug"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc" ],
"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++ launch.json文件内容如下
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/prj/main.exe",
"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"
],
"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 task.json文件配置不需要,需要 launch.json文件配置,如下
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
11.快捷键
官方参考
参考
12.文件比较
参考:https://blog.csdn.net/qq_41151638/article/details/79650141
13.vscode自带terminal:Could not connect to display
解决方法
export DISPLAY=':0.0'
export DISPLAY=':1.0'或export DISPLAY=':2.0'
echo ${DISPLAY}
vim ~/.bashrc
export DISPLAY=':0.0'
14.列编辑
参考博客
- 多光标插入功能
Alt+鼠标左键,添加多光标输入 #only windows - 列选择
Shift+Alt+鼠标左键拖动,选中拖动的区域内容 #windows+linux
15. update
避免每次去官方下载手动安装的麻烦
wget https://vscode-update.azurewebsites.net/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]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"[Makefile]": {
"editor.tabSize": 4,
"editor.insertSpaces": 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官网参考(非常详细)
建议关注:editor.tokenColorCustomizations 的选项配置进行自定义配置,自定义配置内容写入settings.json即可,其它使用主题插件解决
Customize Colors in Global Setting示例
C/C++ Naming Conventions所有自定义支持类型
其它
在线文档:https://houdunren.gitee.io/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/sysctl.conf
fs.inotify.max_user_watches=524288
sudo sysctl -p
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)