VSCode-Cookbook
使用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" } ] }
杂
- 使用一个命令打开特定文件? 不支持: https://github.com/microsoft/vscode/issues/134949
- 有一个插件, 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 gitsvn 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.
draw.io
下图svn:
下图png:
可以直接放入md预览, 不过不能自动上传到cnblogs.
 
https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio, 1.5百万下载, 5星.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理