Vim: Unexpected behaviour when press ')'

Created on 11 Dec 2019  Â·  10Comments  Â·  Source: VSCodeVim/Vim

Describe the bug
Where I press ')', an unexpected string vClosePair(')')\n will show up.

To Reproduce
Steps to reproduce the behavior:

Just press ')' and you will see this bug.

Expected behavior

Just ')' itself.

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.12.2
  • VSCode version: 1.40.2
  • OS: macOS 10.15.1

Additional context
Add any other context about the problem here.

kinbug systelinux systemac

All 10 comments

I find pressing 'backspace' will be the similar case.

This looks similar to https://github.com/VSCodeVim/Vim/issues/4359. @Anlarry what OS are you on? Seems these issues are popping up on unix only.

I am having some similar behaviour on 1.12.2 on linux. VSCode 1.40.

if I type

function foo() {

then press

the result is:

function foo() {
}
}

If I downgrade to 1.11 this issue goes away

+1 for this.
vscodevim 1.12.2 on VS Code 1.39.2 on Ubuntu 19.10.

This looks similar to #4359. @Anlarry what OS are you on? Seems these issues are popping up on unix only.

Yes, my OS is manjaro.
vscodevim 1.12.2 on vscode 1.39.2 on Manjaro 18.1.4

I've finally been able to reproduce one of these bugs that have been popping up lately. I had suspected they might be coming from conflicting vimrc configs, and it appears that might be correct. In particular I was able to reproduce the bug mentioned by @leshow by using a vimrc that I found around, in this case I tracked down the issue to this remap that is supposed to do autobracketing:

inoremap {<cr> {<cr>}<c-o><s-o>

I'm unsure how this particular case could be solved, in reality everything is working as intended, it's just that VSCode does the autobracketing and then this remap inserts the extra }.

I think this might be a lead, and I could investigate it further if I can get more data, i.e. get the vimrc configs of the people experiencing these issues.

Good find. I didn't even realise my .vimrc was taken into account. I can confirm I am using a similar .vimrc entry to add some auto bracketing on cr.

Is there currently any way we can target VS Code in vimrc? Something like

if has("vscode")
    " Some rules
endif

Could be a good way to resolve this.

Edit: in other news, you can disable the extension from reading your .vimrc remaps by setting vim.vimrc.enable to false, which should stop the dual bracket behavior if you're using key mappings in your .vimrc file.

Edit: in other news, you can disable the extension from reading your .vimrc remaps by setting vim.vimrc.enable to false, which should stop the dual bracket behavior if you're using key mappings in your .vimrc file.

This was supposed to be false by default, but I think it slipped by me in review. That's fixed as of 1.12.4.

Is there currently any way we can target VS Code in vimrc?

Nope. I'd like a way to designate certain settings as VSCode-only and as Vim-only. I do like your idea of has("vscode") or similar.

I can confirm I have this in my vimrc. I didn't realise vscodevim was
reading my vimrc, I believe this behaviour changed in recent releases, I've
had the setting in vimrc for a while.

On Sun., Dec. 29, 2019, 11:41 p.m. Jason Fields, notifications@github.com
wrote:

Edit: in other news, you can disable the extension from reading your
.vimrc remaps by setting vim.vimrc.enable to false, which should stop the
dual bracket behavior if you're using key mappings in your .vimrc file.

This was supposed to be false by default, but I think it slipped by me in
review. That's fixed as of 1.12.4.

Is there currently any way we can target VS Code in vimrc?

Nope. I'd like a way to designate certain settings as VSCode-only and as
Vim-only. I do like your idea of has("vscode") or similar.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/VSCodeVim/Vim/issues/4366?email_source=notifications&email_token=AAITO3RWR47NMVRTW7LRFVLQ3F3XXA5CNFSM4JZIHV3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZR6KY#issuecomment-569581355,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAITO3VI7OSVSOLHAC7FTFLQ3F3XXANCNFSM4JZIHV3A
.

Okay, this seems resolved, so I'm closing the issue.

I'll create another issue to tackle the Vim/VSCode-only settings

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edwintorok picture edwintorok  Â·  3Comments

ghost picture ghost  Â·  3Comments

AndersenJ picture AndersenJ  Â·  3Comments

triztian picture triztian  Â·  3Comments

rajinder-yadav picture rajinder-yadav  Â·  3Comments