Notes
1.0.0
1.0.0
  • Introduction
  • Commands
    • cd
    • df
    • du
    • fc-cahe
    • ifconfig
    • ip
    • ls
    • lsb_release
    • mkdir
    • mksquashfs
    • mount
    • ping
    • pwd
    • rm
    • sar
    • sudo
  • Linux C
    • Preprocessor
    • Keywords
    • Kernel
      • Ftrace
      • Watchdog
  • Python
    • general
      • Decorator
      • Generator
      • Iterator
      • Lambda
    • Download
    • NIC
  • Network
    • Protocol
      • Link layer
      • IP
      • ARP
      • ICMP
    • Proxy
      • Cntlm
      • Proxychains4
      • ShadowSocks
    • Tools
      • iperf
      • tc
      • Wireshark
    • Apps
      • samba
      • tftp
  • Software
    • Atom
    • Chrome
    • Docker
    • Git
    • Gitbook
    • Hexo
    • Nodejs
    • Teraterm
    • Tex
    • Tmux
    • VIM
    • VSCode
  • Database
    • MongoDB
  • Web
    • CSS
    • LNMP
  • Tools
    • common
    • programming
  • Ubuntu
    • Add user
    • AWS EC2
    • FAQ
    • Installer
    • Shell
    • Shell scripts
    • Themes
    • VPS
  • Windows
    • PowerShell
    • CMD
    • FAQ
  • Aphorisms
  • Book List
  • Favorites
  • Appendix
    • ASCII
    • GSM
Powered by GitBook
On this page
  • 常用快捷键
  • extensions
  • 常用配置
  • 设置分界线
  • code format
  • python related
  • 开发环境
  • C/C++
  • Code server
  • install on ubuntu
  • run
  • config

Was this helpful?

  1. Software

VSCode

PreviousVIMNextDatabase

Last updated 5 years ago

Was this helpful?

常用快捷键

  • 指令窗口:Ctrl+Shift+P

  • 最近文件:Ctrl+P

  • 选择所有与当前所在单词相同的单词:Ctrl+F2

  • 选择所有与当前所选内容相同的字符串:Ctrl+Shift+L

  • 快捷键列表:

extensions

  • Color Theme

    • Dark(Visual Studio)

    • Solarized Dark

    • One Dark Pro

  • File Icon Theme

    • VSCode Great Icons

    • Material Icon Theme

    • vscode-icons

  • Remote - WSL

  • Vim

  • Language

    • Python

    • C/C++

  • Git

    • GitLens

    • Git History

    • Github

  • Visual

    • Drawio Integration

    • Debug Visualizer

    • HTML Preview

    • hexdump for VSCode

  • Markdown

    • Markdown All in One

    • Markdown PDF

    • Markdown Preview Github Styling

    • markdownlint

  • Debugger for Chrome

  • Apps

    • Zhihu On VSCode

    • LeetCode

常用配置

设置分界线

在settings.json文件中添加editor.rulers,数组每一个数对应一条线。

"editor.rulers": [80,120],

code format

使用Shift Alt F可以自动格式化代码,针对python代码,会提示需要安装autopep8,可以通过VSCode的弹框信息安装,也可以手动安装

pip install --upgrade autopep8

python related

每次执行python代码时,总是会弹出新的terminal,此时可以通过配置launch.json解决这个问题

"console": "integratedTerminal",

references:

PS:我的多台PC的多个系统都装有VSCode和python插件,但并不是所有系统都有这个问题。

PS again: 后经观察,发现在使用git bash时才有这个问题,如果使用CMD作为默认终端则没有这个问题。

开发环境

C/C++

  1. 安装C/C++插件

  2. debug C 代码,自动提示配置launch.json, tasks.json

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gcc - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "gcc build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

tasks.json

{
    "tasks": [
        {
            "type": "shell",
            "label": "gcc build active file",
            "command": "/usr/bin/gcc",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "/usr/bin"
            }
        }
  ],
  "presentation": {
    "echo": true,
    "reveal": "always",
    "focus": false,
    "panel": "shared",
    "showReuseMessage": true,
    "clear": false
  },
    "version": "2.0.0"
}

Code server

在浏览器访问VPS上部署的VSCode server, 简直不要太棒!

install on ubuntu

curl -fsSL https://code-server.dev/install.sh |sh

run

systemctl --user enable --now code-server

config

更改配置文件中的密码、端口(默认8080),如果是用vps,需要将配置文件中的127.0.0.1替换为0.0.0.0,否则打开端口映射也没法访问。

vi ~/.config/code-server/config.yaml
systemctl --user restart code-server

https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf
(Ctrl + ) F5 opening new terminal everytime #56341
Debug Launch Configuration: Add a setting to for integrated.terminal path on each configuration or for all python debugging. #2391
code server