Loading

VSCode 使用技巧笔记

插件

  • Git History (donjayamanne.githistory)

可以按行查看 git 历史记录

  • Git Graph (mhutchie.git-graph)

  • Bookmarks (alefragnani.bookmarks)

  • highlight (debugpig.highlight)

高亮选中的词

小技巧

  • 选择包含指定内容的全部行

在日志文件中,挑选中特定内容的日志时很有用,比如有如下内容

[16:38:04.515] [FTP] [Verbose] (32) Waiting for response to: CWD /
[16:38:04.516] [FTP] [Info] (16) Response: 250 Changed to directory "/" [2ms]
[16:38:04.516] [FTP] [Info] (16) Command:  STOR /root/update.zip
[16:38:04.516] [FTP] [Verbose] (16) Waiting for response to: STOR /root/update.zip
[16:38:04.517] [FTP] [Info] (22) Response: 250 Changed to directory "/" [3ms]
[16:38:04.517] [FTP] [Info] (22) Command:  STOR /root/update.zip
[16:38:04.517] [FTP] [Verbose] (22) Waiting for response to: STOR /root/update.zip
[16:38:04.519] [FTP] [Info] (32) Response: 200 Type set to binary. [3ms]

只想查看包含 "(16)" 这个内容的全部行。

Ctrl+F 进入搜索,开启正则搜索,搜索 ^.*\(16\).*$,按 Alt+Enter(Select All Occurrences of Find Match),即可一次性选中所有匹配的多行。

正则表达式: ^.*pattern.*$
如果需要连同行尾换行一起选中: ^.*pattern.*\r?\n?

  • 删除所有空行

与选中特定内容的行类似,先使用正则 ^\s*$ 搜索,Alt+Enter 选中所有空行,直接按 Backspace 就可以删除了。

posted @ 2025-09-25 18:30  J.晒太阳的猫  阅读(14)  评论(0)    收藏  举报