首页 > 其他分享 >vscode 的vim配置和快捷键配置

vscode 的vim配置和快捷键配置

时间:2022-12-09 19:33:35浏览次数:40  
标签:workbench vscode commands vim action 快捷键 true before

keybinds.json

// Place your key bindings in this file to override the defaultsauto[]
[
  // 以前配置的上下左右移动按键
  {
    "key": "alt+j",
    "command": "cursorLeft",
    "when": "textInputFocus"
  },
  {
    "key": "alt+k",
    "command": "cursorDown",
    "when": "textInputFocus"
  },
  {
    "key": "alt+l",
    "command": "cursorRight",
    "when": "textInputFocus"
  },
  {
    "key": "alt+i",
    "command": "cursorUp",
    "when": "textInputFocus"
  },
  // 切换到文件浏览器,可以在任何位置
  {
    "key": "ctrl+;",
    "command": "workbench.view.explorer",
    "when": "viewContainer.workbench.view.explorer.enabled"
  },
  // 切换到代码编辑区,不论在任何位置
  {
    "key": "ctrl+'",
    "command": "workbench.action.focusFirstEditorGroup"
  },
  // 切换到terminal终端
  {
    "key": "ctrl+,",
    "command": "workbench.action.terminal.toggleTerminal",
    "when": "terminal.active"
  },
  // 打开一个新的terminal
  {
    "key": "ctrl+shift+,",
    "command": "workbench.action.terminal.new",
    "when": "terminalProcessSupported || terminalWebExtensionContributedProfile"
  },
  // 在文件夹资源管理器中新建一个文件
  {
    "key": "a",
    "command": "explorer.newFile",
    "when": "filesExplorerFocus && !inputFocus"
  },
  // 在文件资源管理器里面创建一个文件夹
  {
    "key": "shift+a",
    "command": "explorer.newFolder",
    "when": "filesExplorerFocus && !inputFocus"
  },
  // 在文件资源管理器里面重应名当前文件或文件夹
  {
    "key": "r",
    "command": "renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
  },
  // 在文件资源管理器中删除文件
  {
    "key": "d",
    "command": "deleteFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
  },
  // 复制当前文件
  {
    "key": "y",
    "command": "filesExplorer.copy",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
  },
  // 黏贴当前文件
  {
    "key": "p",
    "command": "filesExplorer.paste",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
  },
  // 放大editor区域
  {
    "key": "ctrl+m",
    "command": "workbench.action.maximizeEditor"
  },
  // 使用code runner运行代码
  {
    "key": "ctrl+r",
    "command": "code-runner.run"
  }
]

settings.json

{
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.formatOnSave": true,
  "editor.lineNumbers": "relative",
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  // -------------------------------------------------
  "vim.leader": "<space>",
  "vim.useSystemClipboard": true,
  "vim.hlsearch": true,
  "vim.highlightedyank.enable": true,
  "vim.foldfix": true,
  "vim.easymotion": true,
  "vim.incsearch": true,
  "vim.useCtrlKeys": true,
  "vim.surround": true,
  "vim.sneak": true,
  "vim.sneakUseIgnorecaseAndSmartcase": true,
  "vim.normalModeKeyBindingsNonRecursive": [
    // Go to start or end of line---------------------------
    {
      "before": ["H"],
      "after": ["^"]
    },
    {
      "before": ["L"],
      "after": ["$"]
    },
    // ----------------------------------------------------
    // Jump to change
    {
      "before": ["[", "c"],
      "commands": ["workbench.action.editor.previousChange"]
    },
    {
      "before": ["]", "c"],
      "commands": ["workbench.action.editor.nextChange"]
    },
    // Code actions
    {
      "before": ["<leader>", "s", "a"],
      "commands": ["editor.action.sourceAction"]
    },
    {
      "before": ["<space>", "r", "r"],
      "commands": [
        // "extension.runScript"
        // "autojspro.run"
        "code-runner.run"
      ]
    },
    // Quick fix
    {
      "before": ["<leader>", "q", "f"],
      "commands": ["editor.action.quickFix"]
    },
    // 重用名变量
    {
      "before": ["<leader>", "r", "n"],
      "commands": ["editor.action.rename"]
    },
    // Format 格式化当前文件
    {
      "before": ["<leader>", "f", "m"],
      "commands": ["editor.action.formatDocument"]
    },
    // go===================================================
    // go to  References
    {
      "before": ["g", "r"],
      "commands": ["editor.action.goToReferences"]
    },
    // ===================================================
    // new===================================================
    // 新建文件夹,在编辑器的区域
    {
      "before": ["<Leader>", "n", "d"],
      "commands": ["explorer.newFolder"]
    },
    // 新建文件,新建文件的位置取决于,文件资源管理器所在的位置
    {
      "before": ["<Leader>", "n", "f"],
      "commands": ["explorer.newFile"]
    },
    // =====================================================
    // open========================================================
    // 打开文件资源管理器,光标会聚焦到文件资源管理器的窗口
    {
      "before": ["<leader>", "o", "e"],
      "commands": ["workbench.view.explorer"]
    },
    // open search bar
    {
      "before": ["<leader>", "o", "s"],
      "commands": ["workbench.action.quickOpen"]
    },
    // 进入到terminal
    {
      "before": ["<leader>", "o", "t"],
      "commands": ["workbench.action.terminal.toggleTerminal"]
    },
    // 新建一个terminal终端
    {
      "before": ["<leader>", "o", "T"],
      "commands": ["workbench.action.terminal.new"]
    },
    // 隐藏和打开terminal
    {
      "before": ["<leader>", "o", "t"],
      "commands": ["workbench.action.togglePanel"]
    },
    // ================================================
    // find char in all files(fing in all files)
    {
      "before": ["<leader>", "f", "a"],
      "commands": ["workbench.action.findInFiles"]
    },
    // ===============================================
    // 移动==============================================================================
    // 左右移动标签页------------------------------------------------
    {
      "before": ["<leader>", "h"],
      "commands": ["workbench.action.navigateLeft"]
    },
    {
      "before": ["<leader>", "l"],
      "commands": ["workbench.action.navigateRight"]
    },
    // 移动下一个编辑器标签
    {
      "before": ["J"],
      "commands": ["workbench.action.nextEditor"]
    },
    // 移动到上一个编辑器标签
    {
      "before": ["K"],
      "commands": ["workbench.action.previousEditor"]
    },
    // 左右移动标签页---------------------------------------------------------------
    {
      "before": ["<space>", "'"],
      "commands": ["workbench.action.maximizeEditor"]
    },
    // 保存当前文件---------------------------------------------------------------
    {
      "before": ["<space>", "s"],
      "commands": ["workbench.action.files.save"]
    },
    {
      "before": ["g", "b"],
      "commands": ["workbench.action.navigateBack"],
      "when": "canNavigateBack"
    },
    // workbench.action.closeActiveEditor
    {
      "before": ["<space>", "w", "c"],
      "commands": ["workbench.action.closeActiveEditor"]
    },
    //workbench.action.closeAllEditors
    {
      "before": ["<space>", "w", "a"],
      "commands": ["workbench.action.closeAllEditors"]
    },

    {
      "before": ["<space>", "q", "f"],
      "commands": ["editor.action.quickFix"]
    }
  ],
  "vim.insertModeKeyBindings": [
    // 退出插入模式
    {
      "before": ["j", "k"],
      "after": ["<Esc>"]
    }
  ],
  "vim.visualModeKeyBindingsNonRecursive": [
    // 移动到非空字符的行首
    {
      "before": ["H"],
      "after": ["^"]
    },
    // 移动到非空字符的行尾
    {
      "before": ["L"],
      "after": ["$"]
    }
  ],
  "vim.digraphs": {},
  "vim.commandLineModeKeyBindings": [],
  "vim.commandLineModeKeyBindingsNonRecursive": [],
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  // ====================================================================
  "EnglishChineseDictionary.enableHover": true,
  "security.workspace.trust.untrustedFiles": "open",
  "[json]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "liveServer.settings.donotShowInfoMsg": true,
  "typescript.updateImportsOnFileMove.enabled": "always",
  "javascript.updateImportsOnFileMove.enabled": "always",
  "workbench.colorTheme": "Monokai",
  "[python]": {
    "editor.defaultFormatter": "ms-python.python"
  },
  // 忽略排除的文件
  "files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/CVS": true,
    "**/.DS_Store": true,
    "**/Thumbs.db": true,
    "**/__pycache__": true, // python 生产的cache文件
    "**/.idea": true
  }
}

标签:workbench,vscode,commands,vim,action,快捷键,true,before
From: https://www.cnblogs.com/zhuoss/p/16969800.html

相关文章

  • 最强 Android Studio 使用小技巧和快捷键总结
    写在前面本文翻译自 AndroidStudioTipsbyPhilippeBreault,一共收集了62个AndroidStudio使用小技巧和快捷键。根据这些小技巧的使用场景,本文将这62个小技巧分为常用......
  • vscode 在debug模式给被调试程序传递环境变量
      https://blog.csdn.net/jinxiaonian11/article/details/127965187 C/C++"environment":[{"name":"ENV_TEST","value":"1"},{"name":"T......
  • vscode使用chatGPT
    vscode使用chatGPT一、下载chatPGT在拓展中找到chatGPT,我这里下载的是中文版二、使用1.使用快捷键ctrl+shift+p进行查找chatGPT2.点击请输入问题3.输入你的问题,......
  • 2022第三届云原生编程挑战赛--Serverless VSCode WebIDE使用体验
    2022第三届云原生编程挑战赛--ServerlessVSCodeWebIDE使用体验​​活动背景​​​​赛题说明​​​​ServerlessVSCodeWebIDE体验​​​​体验入口​​​​什么是Server......
  • 【个人杂谈】Mac 快捷键分享
    最近买了新的MacBookPro14,第一次接触苹果电脑,很多快捷键不熟悉,因此打算在网上查询后将一些常用的快捷键盘做一个简单的汇总。窗口相关⌘+W关闭窗口⌘+M隐藏......
  • Vim学习新发现-1
    Vim诞生于只有键盘而没有指点设备的年代,那时候的键盘也没有如今这样丰富的功能键(想象一下只有Shift和Ctrl的键盘!)。Vim是基于Mode的。通过不同Mode间的切换,Vim可以仅用按键......
  • Linux vi/vim
    所有的UnixLike系统都会内建vi文书编辑器,其他的文书编辑器则不一定会存在。但是目前我们使用比较多的是vim编辑器。vim具有程序编辑的能力,可以主动的以字体颜色辨别......
  • GoLand常用快捷键(转)
    一、Goland快捷键设置GoLand支持各种编辑器的快捷键映射:File(文件)->Settings(设置)->Keymap(按键映射)二、GoLand常用快捷键下面的快捷键都是windows系统的,mac系统把CTRL都替......
  • Windows平台下Vim安装插件(采用内置的包管理器)
    需要提前说明的一些事情本人电脑环境为Windows11,vim采用包管理器scoop下载安装,版本为9.0。在尝试为vim安装插件过程中,参考了知乎上的一篇文章如何安装VIM插件,其中提到在V......
  • vim基本使用
    vim基本使用使用方法在终端输入vim+(文件),如果文件已经存在,则使用vim打开文件,否则创建一个文件。或者,是输入vim直接进入,再输入:e+文件名,来打开文件。进入vim后默认为......