Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual Vim Configuration #2989

Closed
PRATIK-CHOLKE opened this issue Aug 1, 2022 · 7 comments
Closed

Manual Vim Configuration #2989

PRATIK-CHOLKE opened this issue Aug 1, 2022 · 7 comments

Comments

@PRATIK-CHOLKE
Copy link

While setting vim for vs code I have modified my settings.json and keybindings.json files. How do apply that kinds of modifications in Visual Studio 2022?

Following are two files from vscode.

settings.json

{
"vim.easymotion": true,
    "vim.incsearch": true,
    "vim.useSystemClipboard": true,
    "vim.useCtrlKeys": false,
    "vim.hlsearch": true,
    "vim.insertModeKeyBindings": [
        {
          "before": ["j", "j"],
          "after": ["<Esc>"]
        }
    ],
    "vim.normalModeKeyBindingsNonRecursive": [
        {
          "before": ["<leader>", "d"],
          "after": ["d", "d"]
        },
        {
          "before": ["<C-n>"],
          "commands": [":nohl"]
        }
    ],
    "vim.leader": "<space>",
    "vim.handleKeys": {
        "<C-a>": false,
        "<C-f>": false
    },
}

keybindings.json

[
    {
        "key": "tab",
        "command": "tab",
        "when": "editorTextFocus && !editorTabMovesFocus"
    },
    {
        "key": "shift-tab",
        "command": "outdent",
        "when": "editorTextFocus && !editorTabMovesFocus"
    }
]

Note: I have installed VsVim 2022 extension on Visual Studio 2022.

@jaredpar
Copy link
Collaborator

jaredpar commented Aug 1, 2022

To customize VsVim in Visual Studio you generally apply the desired mappings to your _vsvimrc file. There you can use standard :nmap style commands to customize your bindings just as you would for vim proper.

@PRATIK-CHOLKE
Copy link
Author

To customize VsVim in Visual Studio you generally apply the desired mappings to your _vsvimrc file. There you can use standard :nmap style commands to customize your bindings just as you would for vim proper.

Okay. But could you please let me know where _vsvimrc file is located? Or do I need to create that file? My vimfiles folder has subfolders as keymap plugin syntax etc but all those folders are empty.

@ghost
Copy link

ghost commented Aug 1, 2022

Look in %USERPROFILE% (or $env:USERPROFILE, in PowerShell).
(I think it could also be named .vsvimrc.)
If you don't have vim installed, you will probably have to create the _vsvimrc file.
Note jaredpar's comment -- _vsvimrc uses vim keymapping syntax, not VSCode's json.
Also, not all mappings supported in VSCodeVim are necessarily supported in VsVim for VS2022.

@jaredpar
Copy link
Collaborator

jaredpar commented Aug 1, 2022

But could you please let me know where _vsvimrc file is located?

It should exist in the same place as a _vimrc file. Typically most users put this inside of %USERPROFILE%.

Or do I need to create that file?

You need to create that file

@PRATIK-CHOLKE
Copy link
Author

Okay. Thank you @jaredpar and @cbates- I have got what all is needed. Closing the issue.

@edigun-man
Copy link

Okay. Thank you @jaredpar and @cbates- I have got what all is needed. Closing the issue.

SO can i have your setting in vsvimrc? i just need jj

@apsampaio
Copy link

apsampaio commented Oct 4, 2023

Okay. Thank you @jaredpar and @cbates- I have got what all is needed. Closing the issue.

SO can i have your setting in vsvimrc? i just need jj

inoremap jj <ESC>

add this to your .vsvimrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants