3

I'm able to jump to the end of the line in VIM in insert mode by having the following in my .vimrc:

inoremap <C-e> <C-o>$

   inoremap maps a key combination for insert mode
   <C-e> is the keybinding I am creating.
   <C-o> is a command that switches vim to normal mode for one command.
   $ jumps to the end of the line and we are switched back to insert mode.

How can I do that in VSCodeVim plugin?

Here is what I have tried so far:

"vim.insertModeKeyBindings": [
    {
        "before": ["j", "j"],
        "after": ["<Esc>"]
    },
    {
        "before": ["<C-e>"],
        "after": ["<C-o>$"]
    },
    {
        "before": ["<C-r>"],
        "after": [],
        "commands": [
            {
                "command": "redo"
            }
        ]
    },
],
Gama11
  • 31,714
  • 9
  • 78
  • 100
user4426017
  • 1,930
  • 17
  • 31
  • 1. Did you [try anything](https://github.com/VSCodeVim/Vim#%EF%B8%8F-settings)? 2. `` works in Vim and VSCode and possibly every text editor. – romainl Sep 26 '18 at 17:30
  • Yeah, should have mentioned what I have already tried. So far, I have tried all of the following settings individually in my user.settings: ``` "vim.insertModeKeyBindings": [ { "before": [""], "after": [""] }, { "before": [""], "commands": [""] }, { "before": [""], "after": ["$"] } ], ``` – user4426017 Sep 26 '18 at 18:44
  • 1
    You could try custom the `keybindings.json` file, it's in `~/.config/Code/User/` dir on Ubuntu. maybe in another relevant place in your machine. – Shihe Zhang Oct 26 '18 at 08:54

1 Answers1

1

Place the following in your keybindings.json

[
    {
        "key": "ctrl+s e",
        "command": "workbench.action.splitEditor"
    },
    {
        "key": "cmd+\\",
        "command": "-workbench.action.splitEditor"
    },
    {
        "key": "ctrl+s t",
        "command": "workbench.action.terminal.split",
        "when": "terminalFocus"
    },
    {
        "key": "cmd+\\",
        "command": "-workbench.action.terminal.split",
        "when": "terminalFocus"
    },
    {
        "key": "cmd+\\",
        "command": "workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "cmd+b",
        "command": "-workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "cmd+b cmd+",
        "command": "gitlens.openChangedFiles"
    },
    {
        "key": "cmd+b",
        "command": "workbench.action.showAllEditors"
    },
    {
        "key": "alt+cmd+tab",
        "command": "-workbench.action.showAllEditors"
    },
    {
        "key": "ctrl+alt+cmd+",
        "command": "cursorColumnSelectDown",
        "when": "textInputFocus"
    },
    {
        "key": "shift+alt+cmd+down",
        "command": "-cursorColumnSelectDown",
        "when": "textInputFocus"
    },
    {
        "key": "shift+alt+cmd+down",
        "command": "cursorColumnSelectDown"
    },
    {
        "key": "ctrl+a",
        "command": "cursorHome",
        "when": "textInputFocus"
    },
    {
        "key": "ctrl+z",
        "command": "cursorEnd",
        "when": "textInputFocus"
    },
    // {
    //  "key": "ctrl+a",
    //  "command": "cursorLineStart",
    //  "when": "textInputFocus"
    // },
    // {
    //  "key": "ctrl+a",
    //  "command": "-cursorLineStart",
    //  "when": "textInputFocus"
    // },
    {
        "key": "ctrl+cmd+t",
        "command": "workbench.action.reopenClosedEditor"
    },
    {
        "key": "shift+cmd+t",
        "command": "-workbench.action.reopenClosedEditor"
    }
]
Josh Swan
  • 26
  • 3