当前位置: 首页 > news >正文

vscode vim 快捷键汇总

需满足操作:

  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.lryc.cn/news/288563.html

相关文章:

  • npm官方注册表和淘宝镜像切换
  • LFU算法
  • JVM系列-7内存调优
  • [UI5 常用控件] 01.Text
  • C语言之指针的地址和指向的内容总结(八十四)
  • 1月25日,每日信息差
  • 前端工程化之:webpack1-3(模块化兼容性)
  • JDK8新特性(一)
  • java实现ftp协议远程网络下载文件
  • 深入浅出理解目标检测的NMS非极大抑制
  • HbuilderX报错“Error: Fail to open IDE“,以及运行之后没有打开微信开发者,或者运行没有反应的解决办法
  • 【Go 快速入门】基础语法 | 流程控制 | 字符串
  • 腾讯云轻量应用Ubuntu服务器如何一键部署幻兽帕鲁Palworld私服?
  • Redis的SDS你了解吗?
  • C#中常见的软件设计模式及应用场景
  • 字符串相关函数和文件操作
  • 【c++学习】数据结构中的栈
  • 新建react项目,react-router-dom配置路由,引入antd
  • Transformer and Pretrain Language Models3-6
  • Linux系统中编写bash脚本进行mysql的数据同步
  • 光耦驱动继电器电路图大全
  • 【AI量化分析】小明在量化中使用交叉验证原理深度分析解读
  • 2024最新版Visual Studio Code安装使用指南
  • 接口请求重试八种方法
  • 【Linux 基础】常用基础指令(上)
  • 【RT-DETR有效改进】EfficientFormerV2移动设备优化的视觉网络(附对比试验效果图)
  • 《动手学深度学习(PyTorch版)》笔记4.4
  • Linux/Academy
  • windows .vscode的json文件配置 CMake 构建项目 调试窗口中文设置等
  • uniapp canvas做的刮刮乐解决蒙层能自定义图片