vscode vim 快捷键汇总

news/2024/7/21 13:26:43 标签: vscode, vim, ide

需满足操作:

  1. 上下移动
  2. 按照 word 移动
  3. 选中增删改
  4. 查找字符/变量
  5. 移动、增加、复制、删除 行
  6. 选中多个相同的变量/字符
  7. 屏幕移动
  8. 增加多个光标
  9. 快速注释

上下左右移动

CommandDescription
🔢 hleft (also: CTRL-H, BS, or Left key)
🔢 lright (also: Space or Right key)
0to first character in the line (also: Home key)
^to first non-blank character in the line
🔢 $to the last character in the line (N-1 lines lower) (also: End key)
gmto middle of the screen line
🔢 |to column N (default: 1)
🔢 f{char}to the Nth occurrence of {char} to the right
🔢 kup N lines (also: CTRL-P and Up)
🔢 jdown N lines (also: CTRL-J, CTRL-N, NL, and Down)
🔢 -up N lines, on the first non-blank character
🔢 +down N lines, on the first non-blank character (also: CTRL-M and CR)
🔢 _down N-1 lines, on the first non-blank character
🔢 Ggoto line N (default: last line), on the first non-blank character
🔢 gggoto line N (default: first line), on the first non-blank character

按照word移动

CommandDescription
🔢 wN words forward
🔢 WN blank-separated WORDs forward
🔢 eN words forward to the end of the Nth word
🔢 EN words forward to the end of the Nth blank-separated WORD
🔢 bN words backward
🔢 BN blank-separated WORDs backward
🔢 )N sentences forward
🔢 (N sentences backward
🔢 }N paragraphs forward
🔢 {N paragraphs backward

选中增删改

进入 insert mode 后就和之前的模式一样,快捷键有些是和原理的 vscode 一致,有些不一致。

visual mode

CommandDescription
vstart highlighting characters or stop highlighting
Vstart highlighting linewise or stop highlighting
CTRL-Vstart highlighting blockwise or stop highlighting
oexchange cursor position with start of highlighting

删除

CommandDescription
🔢 xdelete N characters under and after the cursor
🔢 Deldelete N characters under and after the cursor
🔢 Xdelete N characters before the cursor
🔢 d{motion}delete the text that is moved over with {motion}
{visual}ddelete the highlighted text
🔢 dddelete N lines
🔢 Ddelete to the end of the line (and N-1 more lines)
(change = delete text and enter Insert mode)
🔢 c{motion}change the text that is moved over with {motion}
{visual}cchange the highlighted text
🔢 ccchange N lines
🔢 Schange N lines
🔢 Cchange to the end of the line (and N-1 more lines)
🔢 shhchange N characters

复制

CommandDescription
"{char}use register {char} for the next delete, yank, or put
"*use register * to access system clipboard
:regshow the contents of all registers
:reg{arg} show the contents of registers mentioned in {arg}
🔢 y{motion}yank the text moved over with {motion} into a register
{visual}yyank the highlighted text into a register
🔢 yyyank N lines into a register
🔢 Yyank N lines into a register
🔢 pput a register after the cursor position (N times)
🔢 Pput a register before the cursor position (N times)
🔢 ]plike p, but adjust indent to current line
🔢 [plike P, but adjust indent to current line
🔢 gplike p, but leave cursor after the new text
🔢 gPlike P, but leave cursor after the new text

增加

CommandDescription
🔢 aappend text after the cursor (N times)
🔢 Aappend text at the end of the line (N times)
🔢 iinsert text before the cursor (N times) (also: Insert)
🔢 Iinsert text before the first non-blank in the line (N times)
🔢 gIinsert text in column 1 (N times)
giinsert at the end of the last change
🔢 oopen a new line below the current line, append text (N times)
🔢 Oopen a new line above the current line, append text (N times)

查找字符/变量

CommandDescription
🔢 /{pattern}[/[offset]]search forward for the Nth occurrence of {pattern} Currently we only support JavaScript Regex but not Vim’s in-house Regex engine.
🔢 ?{pattern}[?[offset]]search backward for the Nth occurrence of {pattern} Currently we only support JavaScript Regex but not Vim’s in-house Regex engine.
🔢 /repeat last search, in the forward direction {count} is not supported.
🔢 ?repeat last search, in the backward direction {count} is not supported.
🔢 nrepeat last search
🔢 Nrepeat last search, in opposite direction

移动、增加、复制、删除 行

复制行
insert mode
alt + shift up/down
删除行
dd
移动行
insert mode
alt + up/down

选中多个相同的变量/字符

CRTL +D选中目标
shift +a/i 防止 curcor 即可编辑全部目标

屏幕移动

CommandDescription
🔢 CTRL-Ewindow N lines downwards (default: 1)
🔢 CTRL-Dwindow N lines Downwards (default: 1/2 window)
🔢 CTRL-Ywindow N lines upwards (default: 1)
🔢 CTRL-Uwindow N lines Upwards (default: 1/2 window)

增加多个光标

in Visual block mode:

CommandDescription
Iinsert the same text in front of all the selected lines
Aappend the same text after all the selected lines

normal mode

alt + command + up / down
then i or a

快速注释

command + /

切换 file

CTRL + TAB
CTRL + 12345

参考:https://github.com/VSCodeVim/Vim/blob/HEAD/ROADMAP.md


http://www.niftyadmin.cn/n/5348063.html

相关文章

conda使用,pip使用

conda 常见命令 关于查看conda信息 查看conda的环境、channels等info信息 conda info查看conda下载过的包 conda list关于下载通道 查看channel: conda config --show-sources删除channel: conda config --remove channels https://mirrors.tuna.…

使用Spring Boot和Tess4J实现本地与远程图片的文字识别

概要: 在本文中,我们将探讨如何在Spring Boot应用程序里集成Tess4J来实现OCR(光学字符识别),以识别出本地和远程图片中的文字。我们将从添加依赖说起,然后创建服务类以实现OCR,最后展示如何处理…

Android创建保存Excel文件

Android开发生成保存Excel文件,首先下载两个jar包。下载地址:Android读写Excel文件的两个jar包资源-CSDN文库 poi-3.12-android-a.jar poi-ooxml-schemas-3.12-20150511-a.jar 把jar包放在app的libs文件夹下,引用jar我一般都在build.gradle的…

信息安全法律法规与国家政策(1)

本文已收录至《全国计算机等级考试——信息 安全技术》专栏 国家相继发布了多个重要的网络安全法案和法规,以《数据安全法》《个信息保护法》《中华人民共和国网络安全法》等为基础的多项政策法规逐步落地实施,我国的网络安全法律体系逐步在完善&#xf…

ES性能优化和注意事项

进阶 数据预处理 Ingest 冷热集群架构 性能优化 硬件配置优化 升级硬件设备配置一直都是提高服务能力最快速有效的手段,在系统层面能够影响应用性能的一般包括三个因素:CPU、内存和 IO,可以从这三方面进行 ES 的性能优化工作。 CPU 配置…

uni-app h5对接 thinkphp5接口跨域

uni-app h5对接 thinkphp5接口跨域 问题描述 请求接口 提示 Access to XMLHttpRequest at http://******* from origin http://localhost:8091 has been blocked by CORS policy: Response to preflight request doesnt pass access control check: It does not have HTTP o…

【iOS ARKit】同时开启前后摄像头BlendShapes

在上一节中已经了解了 iOS ARkit 进行BlendShapes的基本操作,这一小节继续实践同时开启前后摄像头进行人脸捕捉和世界追踪。 iOS设备配备了前后两个摄像头,在运行AR 应用时,需要选择使用哪个摄像头作为图像输人。最常见的AR 体验使用设备后置…

【代码---利用程序读取视频,每隔几帧保存为一张图片】

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言代码详细解释导入OpenCV库:定义保存帧的函数 save_frames:打开视频文件并获取基本信息:输出视频信息:循环读取视…