首页 > 其他分享 >VSCode-Cookbook

VSCode-Cookbook

时间:2023-06-27 19:33:23浏览次数:38  
标签:code VSCode docs vscode https visualstudio Cookbook com

使用portable mode

https://code.visualstudio.com/docs/editor/portable
方便搬运,管理数据.

vscode在windows, 要remote ssh不能联网的linux(A)? 先在能联网的linux(B)中把改装的都装好,能用,再把~/.vscode-server从B搬到A.

https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions

portable升级, 只要把data目录移到新的vscode中就行.

Update Portable VS Code
On Windows and Linux, you can update VS Code by copying the data folder over to a more recent version of VS Code.
On macOS, automatic updates should work as always, no extra work needed.
-- Portable Mode in Visual Studio Code

submodule

"submodules which won't be opened automatically", 把这个选项调大一点, 默认10: git.detectSubmodulesLimit.

Tips and Tricks

https://code.visualstudio.com/docs/getstarted/tips-and-tricks
https://code.visualstudio.com/docs/editor/codebasics, 多光标,列模式,...

  • ctrl-p, 直接查找文件; 也可以输入#, @, >, 分别是C-T, C-S-O, C-S-P; 还可以输入?.
  • 命令行: code -n, new window; code --diff file1 file2, 不支持比较文件夹; code -h; 选项不多; Command Line
  • errors/warnings: C-S-M, A-F8, F8, S-F8
  • split: C-\ (右边), C-K C-\ (下面), in explorer: A-click, C-Enter
  • 切换group, C-1, 2, 3, ...;
  • ctrl-alt-left/write, 把tab移到左边/右边的group
  • to match one or more characters in a path segment
    ? to match on one character in a path segment
    ** to match any number of path segments, including none
    {} to group conditions (for example {/*.html,/*.txt} matches all HTML and text files)
    [] to declare a range of characters to match (example.[0-9] to match on example.0, example.1, …)
    -- Basic Editing in Visual Studio Code

https://code.visualstudio.com/docs/getstarted/userinterface
https://code.visualstudio.com/docs/getstarted/settings#_default-settings
https://code.visualstudio.com/docs/getstarted/settings#_languagespecific-editor-settings

key bindings

https://code.visualstudio.com/docs/getstarted/keybindings
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf

Ctrl-K Ctrl-S: 查询如"Ctrl+T", 可查找键盘冲突
用户修改过的: @source:user

中英文等宽

14寸1920x1080, Win10, 设置如下(前两个字体就够了), 字号14,16都可以. 需要下载UbuntuMono字体.

如果分表率低如14寸1366x768,可尝试

Inconsolata, '黑体'

目录的git history

左侧Explorer, 右键一个目录, Open Folder History.

Have a look at the recent GitLens version (11.4.0, released on 2021-04-08) : https://github.com/eamodio/vscode-gitlens/blob/main/CHANGELOG.md
This VSCode extension has just introduced a way to display the git history of a folder. Right click on a folder in the file explorer tree, select Open Folder History and you should then see the expected log in a dedicated view.
-- How can I view the Git history for a folder, in Visual Studio Code? - Stack Overflow

foam/Zettelkasten

https://github.com/foambubble/foam
https://zettelkasten.de/posts/overview/
https://www.buildingasecondbrain.com/

c/c++

https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference
https://code.visualstudio.com/docs/cpp/cpp-debug
https://code.visualstudio.com/docs/editor/debugging

https://code.visualstudio.com/docs/editor/integrated-terminal
https://www.growingwiththeweb.com/2017/03/mastering-vscodes-terminal.html

完整打印字符串, 默认打印前200字符:

"Configurations": [
	{
		...
		"type": cppdbg",
		...
		"setupCommands": [
			{
				"text": "set print element 0"
			}
		]
	}
]

调式core文件:https://stackoverflow.com/questions/55736235/how-do-you-debug-a-linux-core-dump-using-vscode

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "cppdbg",
            "request": "launch",
            "name": "Open a core dump(c/c++)",
            "program": "<Path to the program here>",
            "coreDumpPath": "${input:coreFileName}",
            "cwd": "${workspaceFolder}",
            "MIMode": "lldb" // or gdb, if you are using gdb
        }
    ],
    "inputs": [
      {
        "id": "coreFileName",
        "type": "promptString",
        "description": "Enter core file path"
      }
    ]
}

  1. 使用一个命令打开特定文件? 不支持: https://github.com/microsoft/vscode/issues/134949
    1. 有一个插件, HTML Related Links, 没试过: https://stackoverflow.com/questions/57080345/keybinding-to-open-a-specific-file-in-vscode

markdown

vim

2015年vscode发布, 慢慢从emacs转向vscode, 直接在centos6/7 gnome里面跑;
2022/12/9, 丢掉了vscode vim插件(主要是模式切换中文搞不定,im-select不好用), 解放了.

git

svn

Git svn rebase : checksum mismatch, https://stackoverflow.com/questions/3156744/git-svn-rebase-checksum-mismatch

See what was the revision number of the last change on the file:
git svn log chrome/test/functional/search_engines.py
Reset svn to be closest parent before that revision:
git svn reset -r62248 -p
Do a git svn fetch!
Dance at your success.

remote-ssh


Bad Owner or Permissions on username.ssh\config file

Actually I solved this problem in vscode-remote by modifying remote.SSH.configFile ...
IdentityFile C:/Users/lilei/.ssh/id_rsa
-- Bad Owner or Permissions on username.ssh\config file · Issue #3210 · microsoft/vscode-docs · GitHub


hyper-v虚拟机,主机没联网,ssh建立连接特别慢,2分钟?
抓了包,发现是dns,换个dns? 或者修改/etc/ssh/sshd_config, useDNS no, systemctl restart sshd.

标签:code,VSCode,docs,vscode,https,visualstudio,Cookbook,com
From: https://www.cnblogs.com/faxx/p/17509754.html

相关文章

  • Linux系统下安装vscode
    正点原子安装视频 跟着教程一步步来即可,但是看视频太麻烦了,写个博客做个记录前往vscode官网下载linux版本vscode链接在这 可以将连接复制到linux下进行下载,windows传过去也怪麻烦的我采用的是Ubuntu因此下载.dep文件  打开所在文件夹通过终端控制指令进行安装,如下代码:......
  • vscode--C++配置问题
    1、#include<iostream>报红但是能正常运行解决方案:win+Rcmd进入输入gcc-v-E-xc++-将红框中数据复制进随后保存即可......
  • 在vscode搜索两个关键词?
    在VSCode中,您可以使用以下方法搜索两个关键词: ①使用正则表达式搜索:打开搜索功能:按下Ctrl+Shift+F(Windows/Linux)或Cmd+Shift+F(Mac)。在搜索框中输入要搜索的关键词,使用正则表达式的语法。例如,如果要搜索同时包含关键词"keyword1"和"keyword2"的内容,可以使用正......
  • 【node.js】Node.js下载安装(在vscode中使用)01
    ......
  • code2md_vscode代码备份_img2md
    code2md/run_img2markdown.command#!/bin/bashsource/Users/song/Code/script_python/code2md/venv/bin/activate#echo-n'请任意拖入文件夹中的一个文件:'#readfile_pathpython3/Users/song/Code/script_python/code2md/main_img2markdown.pycode2md/main......
  • Z_vscode的代码片_NOTE
    snippets/markdown.json{//Placeyoursnippetsformarkdownhere.Eachsnippetisdefinedunderasnippetnameandhasaprefix,bodyand//description.Theprefixiswhatisusedtotriggerthesnippetandthebodywillbeexpandedandinserted.Po......
  • 在VScode中,文件自动添加头部注释-插件koroFileHeader配置
    1、扩展商店,搜索koroFileHeader进行安装2、打开设置-搜索Fileheader-点击头部注释的setting.json文件3、可以在其中配置头部注释"fileheader.customMade":{"Author":"gitconfiguser.name",//作者//"Author":"gitconfiguser.name",//可以获......
  • VSCode-代码运行相关
    快捷键Ctrl+Shift+P搜索Ctrl+F5运行代码Ctrl+,打开设置Ctrl+Shift+E打开文件Ctrl+Alt+C打开博客园功能设置文件:settings.json隐藏以及排除git相关文件设置界面字体Go语言Go运行->教程->测试安装Go语言https://www.cnblogs.com/nrocky/p/14449987.html......
  • VScode打开黑屏
    为了介绍exlg的cph功能,我安装了VScode,并顺手把下载了几个小时的VS删了,配置了C++环境。今天打开VScode发现什么也没有,就一块灰色的屏幕,bdfs无果。如果你坚信扩展就是VScode的一切,那么可以看看我的方法。下面讲一下我的方法。把有关VScode的文件都删了,除了MinGW。重新安装VScode,......
  • VScode插件配置
    前言统计,并记录一下自己的VScode的相关配置,便于更换电脑的时候能够快速配置好开发环境。虽然VScode可以同步账号配置,但是如果电脑相关环境地址不同的化,还是需要重新配置一下。所以这里记录一下如何配置。①koroFileHeader插件配置插件介绍VSCode插件:用于一键生成文件头部......