本文已同步到https://www.aukocharlie.com/archives/vscode%E8%AE%BE%E7%BD%AE%E5%8F%8C%E5%BF%AB%E6%8D%B7%E9%94%AE

平时写代码会经常用到上下左右键,比如打出两个括号 () ,编辑完之后得按到右括号后面

难免有这样的场景需要在编辑代码的时候小范围地移动光标,笔者在别的ide的习惯是通过“alt + jkli”来实现光标移动,网上搜VS Code快捷键设置基本只能找到改默认值的方法,而没有能设置 相同的操作同时有多个快捷键的方法

废话少说,进入正题

首先打开快捷键设置

录制按键,按下“右键”,来查找相关快捷键,箭头所指为要找的(编辑时的光标移动)

右键更改键绑定,改为 alt+l ,若冲突,可以视情况把冲突的快捷键改成别的(比如已经存在alt+l,则把它改为ctrl+alt+l

更改完之后,点击右上角的以JSON格式打开,会打开keybinding.json文件

会形成类似这样的json

原来的right键的command前面加上了- 号来"消除"此快捷方式,那么同理,去掉这个负号就可以“生效”

去掉后发现就可以实现同样的快捷操作可以有多种快捷键

其他方向键类似,读者可以自行实现

最后附上我的keybinding.json

// 将键绑定放在此文件中以覆盖默认值auto[]
[
{
"key": "alt+i",
"command": "cursorUp",
"when": "textInputFocus"
},
{
"key": "up",
"command": "cursorUp",
"when": "textInputFocus"
},
{
"key": "alt+k",
"command": "cursorDown",
"when": "textInputFocus"
},
{
"key": "down",
"command": "cursorDown",
"when": "textInputFocus"
},
{
"key": "alt+j",
"command": "cursorLeft",
"when": "textInputFocus"
},
{
"key": "left",
"command": "cursorLeft",
"when": "textInputFocus"
},
{
"key": "alt+l",
"command": "cursorRight",
"when": "textInputFocus"
},
{
"key": "right",
"command": "cursorRight",
"when": "textInputFocus"
},
{
"key": "down",
"command": "list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "down",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "alt+k",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "up",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "alt+i",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
]

  

最新文章

  1. K-means聚类算法
  2. timus_1007_bfs
  3. linux平台下防火墙iptables原理(转)
  4. OutputFormat中OutputCommitter解析
  5. sql快速生成大量数据
  6. pytesser图片文本识别
  7. 屏蔽webbrowser控件右键的一种方法
  8. JavaScript简单的一些....
  9. 从On-Premise本地到On-Cloud云上运维的演进
  10. linux基础16-bash编程(case语句及脚本选项 )
  11. C#使用List实现类似RadioButtonGroup的单选功能
  12. java web项目由http转换成https遇到的各种坑
  13. 修改hosts文件用来观看coursera视频
  14. Linux - 多窗口管理器Screen程序
  15. JAVA OCR图片识别
  16. 【JEECG技术文档】数据权限自定义SQL表达式用法说明
  17. rviz1
  18. 开机自启动nginx,php-fpm
  19. Spark2 ML包之决策树分类Decision tree classifier详细解说
  20. svn+apache快速安装

热门文章

  1. IOC和AOP使用扩展之AOP详解实现类
  2. 网页分页page
  3. 普通用户sudo权限
  4. js方法返回多值如何取值demo
  5. fengmiantu---
  6. Netflow elasticflow
  7. apache配置补充
  8. be of +名词 = 形容词 (词性变化) ; || it is adj. of + 人称宾格 = 人称主格 + 形容词 (人称变化)
  9. spring自动注入的三种方式
  10. tcpdump中文帮助