• 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": [""]
            }
        ],
        "vim.normalModeKeyBindingsNonRecursive": [
            {
                "before":[
                    "leader",
                    "e"
                ],
                "commands": [
                    {
                    "command": "workbench.action.toggleSidebarVisibility"
                    }
                ]
            },
            {
            "before": [""],
            "after": ["4","j"]
            },
            {
            "before": [""],
            "after": ["4","k"]
            },
            {
            "before": [""],
            "after": ["9","j"]
            },
            {
            "before": [""],
            "after": ["9","k"]
            },
            {
    
            "before": [""],
            "commands": [":nohl"]
            },
            {
            "before": ["K"],
            "commands": ["lineBreakInsert"],
            "silent": true
            },
            {
            "before": [""],
            "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": "",
        "vim.handleKeys": {
            "": false,
            "": false
        },
    
        "extensions.experimental.affinity": {
            "vscodevim.vim": 1
        },
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118

    然后是一些更加定制的东西,需要用到当前的不同状态,因此在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"
      }
    ]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112

    浏览器+vim

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

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

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

    将默认搜索引擎变为bing

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

    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: "";
    }
    
    .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 */
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338

    lazyvim

    下载powershell

    下载Neovim

    下载lazyvim的配置

  • 相关阅读:
    PHP基础教程——总结W3school
    递推算法 C++
    “torch.load“中出现的“Unexpected key(s) in state_dict“报错问题
    分享一下微信公众号怎么实现积分商城功能
    Java抽象类
    数据持久化层场景实战:业务场景+数据库分区+冷热分离概述
    React 18 + Babel 7 + Webpack 5 开发环境搭建
    pyqt5 学习笔记八 (窗口、信号与槽)
    leetcode 24. 两两交换链表中的节点
    算法导论习题—二叉搜索树、红黑树、区间树
  • 原文地址:https://blog.csdn.net/a12377978/article/details/136143785