1

How I can rebind escape key in vsvim (in Visual Studio 2015)? Now, I use esc or ctrl + [ to enter command mode, but I want to use df keys instead. How I can rebind them?
I find out that I need to create .vsvimrc file in my HOME directory and write there some command similar to nmap <df> :vsc MyCommand. Is it right?
But I don't understand what exactly command must be instead "MyCommand".

sudo bangbang
  • 27,127
  • 11
  • 75
  • 77

3 Answers3

5

You do need a .vimrc file. On a mac or linux computer it would go in your home directory. I'm guessing from your question that you might be on Windows. A brief google search indicates that the HOME directory on Windows is also probably right. If you want to check for sure, open vim, type :echo $HOME, and press enter. It will print the file path. Also, on Windows this file should be called _vimrc.

Once you've created your vimrc file include this line

inoremap df <esc>

You'll have to close vim and reopen it for the command work.

lwassink
  • 1,595
  • 13
  • 16
  • Actually to learn file folder use `:set vimrcpaths?` in visual studio. After creating/changing file and restarting studio check loaded file with `:set vimrc?` – nnovich-OK Dec 02 '20 at 15:30
  • I had to use `` instead of `` for it to work perfectly – Adeeb HS May 19 '22 at 04:13
0

I looked for this line: inoremap df <esc>, because I use "escape" or "ctrl + [" to enter command mode from input mode.

  • Absolutely right - silly mistake on my part. My answer should have read `inoremap`. I've edited it. – lwassink Jun 21 '16 at 03:27
0

In Visual Studio VsVim on Mac, there is an option in settings:

Menu: Visual Studio > Preferences > Other > Vim Settings

I use jk in the Insert mode escape binding option and it works well. The .vimrc change did not work for me but given this setting in the GUI, I did not further investigate why my rc file wasn't being respected.

JR Lawhorne
  • 3,192
  • 4
  • 31
  • 41