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

Vim相关配置

记录一下有关vim的一些设置,以免电脑寄了不好重新配置

vscode+vim

首先是vscode中的vim模式
在应用商店中搜索vim插件安装即可
然后在setting中添加以下有关vim 的配置

    "vim.easymotion": true,"vim.surround": true,"vim.incsearch": true,"vim.useSystemClipboard": true,"editor.lineNumbers": "relative","vim.useCtrlKeys": true,"vim.hlsearch": true,"vim.smartRelativeLine": false,"editor.cursorBlinking": "smooth","editor.cursorSmoothCaretAnimation": "on","vim.insertModeKeyBindings": [{"before": ["j", "j"],"after": ["<Esc>"]}],"vim.normalModeKeyBindingsNonRecursive": [{"before":["leader","e"],"commands": [{"command": "workbench.action.toggleSidebarVisibility"}]},{"before": ["<C-j>"],"after": ["4","j"]},{"before": ["<C-k>"],"after": ["4","k"]},{"before": ["<C-d>"],"after": ["9","j"]},{"before": ["<C-u>"],"after": ["9","k"]},{"before": ["<C-n>"],"commands": [":nohl"]},{"before": ["K"],"commands": ["lineBreakInsert"],"silent": true},{"before": ["<C-p>"],"commands": ["extension.fuzzySearch"],},{"before": ["H"],"after": ["^"            ]},{"before": ["L"],"after": ["$"            ]}],"vim.visualModeKeyBindings": [{"before": [">"],"commands": ["editor.action.indentLines"]},{"before": ["<"],"commands": ["editor.action.outdentLines"]},{"before": ["H"],"after": ["^"            ]},{"before": ["L"],"after": ["$"            ]}],"vim.leader": "<space>","vim.handleKeys": {"<C-a>": false,"<C-f>": false},"extensions.experimental.affinity": {"vscodevim.vim": 1},

然后是一些更加定制的东西,需要用到当前的不同状态,因此在keybindings.json中添加以下内容

[{"key": "ctrl+left","command": "workbench.action.increaseViewWidth","when": "vim.mode == 'Normal'"},{"key": "ctrl+right","command": "workbench.action.decreaseViewWidth","when": "vim.mode == 'Normal'"},{"key": "ctrl+up","command": "workbench.action.increaseViewHeight","when": "vim.mode == 'Normal'"},{"key": "ctrl+down","command": "workbench.action.decreaseViewHeight","when": "vim.mode == 'Normal'"},// 以下是 vim 绑定的键位{"key": "alt+j","command": "selectNextSuggestion","when": "vim.active && suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"},{"key": "alt+k","command": "selectPrevSuggestion","when": "vim.active && suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"},// 在 quickOpen 的对话框中上下跳转{"key": "ctrl+j","command": "workbench.action.quickOpenSelectNext","when": "vim.active && inQuickOpen"},{"key": "ctrl+k","command": "workbench.action.quickOpenSelectPrevious","when": "vim.active && inQuickOpen"},// 当光标聚焦在编辑器中且 vim 处于 normal 模式时,进行 tab 栏目的左右跳转{"key": "alt+h","command": "workbench.action.previousEditor","when": "editorTextFocus && vim.mode == 'Normal'"},{"key": "alt+l","command": "workbench.action.nextEditor","when": "editorTextFocus && vim.mode == 'Normal'"},// vim 模式下的左侧的文件管理器的操作// 在文件管理器中搜索{"key": "/","command": "list.find","when": "listFocus && listSupportsFind && !inputFocus"},// 新建一个文件{"key": "a","command": "explorer.newFile","when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"},// 新建一个文件夹{"key": "shift+a","command": "explorer.newFolder","when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"},// 给文件重命名{"key": "r","command": "renameFile","when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"},// 删除文件{"key": "d","command": "deleteFile","when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"},// 调整底部的 panel 的大小{"key": "ctrl+shift+k","command": "workbench.action.terminal.resizePaneUp","when": "terminalFocus"},{"key": "ctrl+shift+j","command": "workbench.action.terminal.resizePaneDown","when": "terminalFocus"},// 最大化 terminal{"key": "ctrl+win+`","command": "workbench.action.toggleMaximizedPanel","when": "terminalFocus"},{"key": "ctrl+w","command": "-workbench.action.closeActiveEditor"}
]

浏览器+vim

下载Vimium C插件,实现全键盘操作浏览器

主要就改了两个快捷键,让ctrl+j/k 快速上下翻动

map <c-j> scrollDown count=3
map <c-k> scrollUp count=3

将默认搜索引擎变为bing

https://cn.bing.com/search?q=$s

UI选的是下面这个配置

/* #ui */
* {
/*insertroot*/--font-size: 17px;--font-size-link: 12px;--font-weight: normal;--font: Source Code Pro, sans;--padding: 0px;--shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);/* ----------  DAY THEME  ---------- */--bg: #282c34;--fg: #969ca8;--accent-fg: #2e323c;--border: #000000;--title: #969ca8;--title-accent: #4892c6;--link: #6b7176;--link-accent: #d7ae74;/* ---------- NIGHT THEME ---------- */--nbg: #282c34;--nfg: #969ca8;--naccent-fg: #2e323c;--nborder: #000000;--ntitle: #969ca8;--ntitle-accent: #4892c6;--nlink: #6b7176;--nlink-accent: #d7ae74;font-family: var(--font);font-size: var(--font-size-link);
}/* HUD */
.HUD {border-radius: 3px;text-transform: lowercase;color: var(--title);max-width: 420px;min-width: unset;line-height: 20px;align-items: center;padding: 10px;
}.HUD.D {color: var(--ntitle);
}.HUD:after {background: var(--bg);border: var(--border);
}.HUD.D:after {background: var(--nbg);border: var(--nborder);
}.HUD.UI {min-width: 380px;align-items: unset;
}/* HINTS */
.LH {color: var(--fg);border: 1px solid var(--border);background: var(--bg);box-shadow: var(--shadow);
}.D .LH {color: var(--nfg);border: 1px solid var(--nborder);background: var(--nbg);box-shadow: var(--shadow);
}.MC {color: var(--accent-fg);
}.D .MC {color: var(--naccent-fg);
}/* #omni */
* {
/*insertroot*/--font-size: 17px;--font-size-link: 12px;--font-weight: normal;--font: Source Code Pro, sans;--padding: 0px;--shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);/* ----------  DAY THEME  ---------- */--bg: #282c34;--fg: #969ca8;--accent-fg: #2e323c;--border: #000000;--title: #969ca8;--title-accent: #4892c6;--link: #6b7176;--link-accent: #d7ae74;/* ---------- NIGHT THEME ---------- */--nbg: #282c34;--nfg: #969ca8;--naccent-fg: #2e323c;--nborder: #000000;--ntitle: #969ca8;--ntitle-accent: #4892c6;--nlink: #6b7176;--nlink-accent: #d7ae74;font-family: var(--font);/*font-size: var(--font-size);*/
}body {animation: show 200ms cubic-bezier(0, 0, 0.2, 1) forwards;box-shadow: var(--shadow);
}body.has-dark{}/* Animate Slide in */
@keyframes show {0% {opacity: 0;transform: translateY(50px);}100% {opacity: 1;transform: translateY(0);}
}#toolbar {top: 10px;right: 14px;opacity: 0;
}#toolbar:hover {opacity: 1;
}#bar, #input, #list {background: var(--bg);font-weight: var(--font-weight);
}
.has-dark #bar, .has-dark #input, .has-dark #list {background: var(--nbg);
}#bar{padding: 10px;
/*padding: var(--padding);*/border-bottom: none;
}#bar::before{
/*for hint or content icon before typing*/content: "➤";position: absolute;left: 20px;z-index: 300;padding: 6px 0;font-weight: bold;font-size: var(--font-size);color: var(--fg);
}.has-dark #bar::before{color: var(--nfg);
}#input {padding: var(--padding) 38px;color: var(--title);border: none;box-shadow: none;
}.has-dark #input {color: var(--ntitle);
}.item .icon {width: 24px;height: 24px;padding-right: unset;margin-right: 10px;margin-top: 5px;background-position: bottom right;
}.item .icon path {opacity: 0.25;position: absolute;z-index: -1;transform-origin: 0px 0px;transform: scale(0.75);
}.item.s,
.item:hover {background-color: var(--accent-fg);border: 3px rgba(0, 0, 0, 0.02) solid;cursor: pointer;
}.has-dark .item.s,
.has-dark .item:hover {background-color: var(--naccent-fg);
}.item .top {color: var(--title);position: relative;height: 30px;
}.has-dark .item .top {color: var(--ntitle);
}.item .top .title {font-size: var(--font-size);line-height: 10px;margin-top: 2px;
}.item .top .title match {color: var(--title-accent);
}.has-dark .item .top .title match {color: var(--ntitle-accent);
}.item .top .title:empty::after {content: "<blank>";
}.item .bottom {margin-top: -14px;padding-left: 14px;
}.item .bottom a {color: var(--link);font-size: var(--font-size-link);
}.has-dark .item .bottom a {color: var(--nlink);
}.item .bottom a match {color: var(--nlink-accent);text-decoration: none;
}.has-dark .item .bottom a match {color: var(--nlink-accent);
}/* #find */
* {
/*insertroot*/--font-size: 17px;--font-size-link: 12px;--font-weight: normal;--font: Source Code Pro, sans;--padding: 0px;--shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);/* ----------  DAY THEME  ---------- */--bg: #282c34;--fg: #969ca8;--accent-fg: #2e323c;--border: #000000;--title: #969ca8;--title-accent: #4892c6;--link: #6b7176;--link-accent: #d7ae74;/* ---------- NIGHT THEME ---------- */--nbg: #282c34;--nfg: #969ca8;--naccent-fg: #2e323c;--nborder: #000000;--ntitle: #969ca8;--ntitle-accent: #4892c6;--nlink: #6b7176;--nlink-accent: #d7ae74;font-family: var(--font);/*font-size: var(--font-size);*/
}.r {color: var(--title-accent);background: var(--bg);border: none;box-shadow: none;
}.r.D {color: var(--ntitle-accent);background: var(--nbg);
}#i {color: var(--link-accent);
}.D #i {color: var(--nlink-accent);
}/* #find:host *//* #find:selection */

lazyvim

下载powershell

下载Neovim

下载lazyvim的配置

http://www.lryc.cn/news/301887.html

相关文章:

  • ARMv8-AArch64 的异常处理模型详解之异常处理详解(进入异常以及异常路由)
  • unity学习(19)——客户端与服务器合力完成注册功能(1)入门准备
  • 论文精读--对比学习论文综述
  • 文章复现 | 差异分析和PPI网络构建
  • 入门级10寸加固行业平板—EM-I10J
  • gem5 garnet 合成流量: packet注入流程
  • java实现排序算法(上)
  • 「算法」滑动窗口
  • Windows11(非WSL)安装Installing llama-cpp-python with GPU Support
  • rtt设备io框架面向对象学习-脉冲编码器设备
  • 华为OD机试真题- 攀登者2-2024年OD统一考试(C卷)
  • 19.Qt 组合框的实现和应用
  • 【Linux】进程地址空间的理解
  • 【Jvm】类加载机制(Class Loading Mechanism)原理及应用场景
  • Spring AOP的实现方式
  • Linux------环境变量
  • 计算机视觉所需要的数学基础
  • ChatGPT魔法1: 背后的原理
  • 【c/c++】获取时间
  • uniapp富文本文字长按选中(用于复制,兼容H5、APP、小程序三端)
  • 常见的几种Web安全问题测试简介
  • linux信号机制[一]
  • elementui 中el-date-picker 选择年后输出的是Wed Jan 01 2025 00:00:00 GMT+0800 (中国标准时间)
  • Redis 集群(Cluster)
  • 260.【华为OD机试真题】信道分配(贪心算法-JavaPythonC++JS实现)
  • Python打发无聊时光:3.实现简单电路的仿真
  • MyBatis-Plus:通用分页实体封装
  • MVC 、DDD(domain-driven design,软件主动学习业务)、中台、Java SPI(Service Provider Interface)
  • 添加环境变量
  • 学习Android的第十六天