文章目錄
VSCode使用之後,瞬間就愛上了此款編輯器
0.安裝
在Ubuntu軟件中心,直接搜索Visual Studio Code
sudo dpkg -i code_1.25.1-1531323788_amd64.deb
#sudo apt --fix-broken install ./code_1.25.1-1531323788_amd64.deb
code #打開vscode軟件
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
Sort lines
Better Align
vscode-pdf
vscode-icons
Material Icon Theme #推薦
Settings Sync #推薦
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
Markdown All in One
markdownlint
Markdown Preview Enhanced
#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 依賴插件
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
File->Preference->Text Editor->Font
"editor.fontFamily": "Fira Code",//後邊的引號中寫上要設置的字體類型,個人比較喜歡Fira Code
"editor.fontLigatures": true,//這個控制是否啓用字體連字,true啓用,false不啓用,這裏選擇啓用
"editor.fontSize": 14,//設置字體大小
"editor.fontWeight": "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
7.terminal自定義顏色配置
參考:https://www.jianshu.com/p/20311e5dc104
"workbench.colorCustomizations": {
// "editor.background": "#1f1f2c",
// "editorGutter.background": "#1d1f2e"
"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.單步調試
https://www.jianshu.com/p/8cdd3e39f45f
11.快捷鍵
官方參考:https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf
參考:https://blog.csdn.net/weixin_34358365/article/details/89133959
#vscode 界面
Ctrl+shift+p->keyboard->open keyboard shurtcuts
調試 Debug
快捷鍵 | 功能 |
---|---|
F9 | 切換斷點 Toggle breakpoint |
F5 | 開始/繼續 Start/Continue |
Shift+F5 | 停止 Stop |
F11 / Shift+F11 | 下一步/上一步 Step into/out |
F10 | 跳過 Step over |
Ctrl+K Ctrl+I | 顯示懸停 Show hover |
集成終端
快捷鍵 | 功能 |
---|---|
Ctrl+` | 顯示/關閉集成終端 |
Ctrl+Shift+` | 創建新終端 Create new terminal |
Ctrl+↑ / ↓ | 向上/向下滾動 Scroll up/down |
Ctrl+Home / End | 滾動到頂部/底部 Scroll to top/bottom |
終端和編輯器之間切換的快捷鍵
https://blog.csdn.net/Jeffxu_lib/article/details/86651173
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'
#至於何時爲1.0或2.0或0.0,可以在終端執行:
echo ${DISPLAY}
#顯示的是什麼配置成什麼就行了
#啓動時自動設置,如下修改配置文件
vim ~/.bashrc
export DISPLAY=':0.0'
其它
在線文檔:https://houdunren.gitee.io/note/