ubuntu18之VScode

文章目录

  • 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.列编辑
  • 其它

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'

14.列编辑

参考博客

  1. 多光标插入功能
    Alt+鼠标左键,添加多光标输入 #only windows
  2. 列选择
    Shift+Alt+鼠标左键拖动,选中拖动的区域内容 #windows+linux

其它

在线文档:https://houdunren.gitee.io/note/

你可能感兴趣的:(编辑器)