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

Switches to VIM mode unexpectly (ctrl+f search & multi-cursor) #5218

Closed
ReedyBear opened this issue Sep 23, 2020 · 12 comments
Closed

Switches to VIM mode unexpectly (ctrl+f search & multi-cursor) #5218

ReedyBear opened this issue Sep 23, 2020 · 12 comments

Comments

@ReedyBear
Copy link
Contributor

ReedyBear commented Sep 23, 2020

Describe the bug
Searching for text with ctrl+f switches to VIM mode. Issue began today. I think VSCode updated yesterday on my comp. But issue didn't start til I rebooted and I got on to code today.

To Reproduce

  1. Press [ctrl+f] to open VSCode's built-in find dialog
  2. Type some characters
  3. My cursor is now showing that I'm in VIM mode & I have to press [a] twice to go back to a normal cursor / input ("insert" mode?)

Expected behavior
The mode I'm in before searching should be the same as after I'm searching.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.17.0
  • VSCode version: 1.49.1
  • OS: Fedora 32
@ReedyBear
Copy link
Contributor Author

I'm also having this issue when trying to use multi-cursor.

  1. hold [alt] & double-click on a word to highlight it
  2. I'm now in VIM mode

After step 1, if I hold [alt] & double-click on another word, it only selects characters to the left of my cursor, instead of selecting the entire second word.

Sometimes it only happens after trying to multi-cursor select a second word.

Then with two words higlighted, pressing [a] (no matter how many times) does not return me to insert mode. & it just seems totally unpredictable at this point.

@ReedyBear ReedyBear changed the title Searching for text with ctrl+f switches to VIM mode Switches to VIM mode unexpectly (ctrl+f search & multi-cursor) Sep 23, 2020
@ReedyBear
Copy link
Contributor Author

Both issues are resolved by rolling the extension back to version 1.16.0.
For others encountering this issue, click the 'gear' icon for the extension & choose 'Install Another Version...':
Screenshot from 2020-09-23 06-07-53

@yubaoquan
Copy link

yubaoquan commented Sep 25, 2020

Same issue. What's more, after switched to normal mode by searching text, I have to type A or i three times to switch to insert mode.

Happens in my win10 computer, mac doesn't has this issue.

@berknam
Copy link
Contributor

berknam commented Sep 28, 2020

@Taeluf When you say it goes into VIM mode do you mean it goes into Visual Mode?

@yubaoquan Can you reproduce this right after opening a new instance of VSCode or only after some use?

I believe this is due to a bug when using multicursors that leaves VSCodeVim in state where all selection/cursor changes are ignored. (this might happen when usin 'alt+click' or using snippets)

Also what you're mentioning after making a search, that is expected behavior. When you make a search vscode selects the word so Vim changes to visual mode. Whenever you're working with a selection you should be in visual mode. That's how normal Vim works as well.

If you want to replace that selection with something else you just press c (change) and start typing whatever you want. If you want to copy that region press y, if you want to enter insert mode after that word you can press A or <Esc> a, and the same applies to everything else.

But if VSCodeVim is in that weird state I mentioned above it won't actually go into visual mode, it goes into normal mode, but if you do some motion or press 'a' or 'i' it jumps back to the previous location.

Can any of you try the PR #5250 to see if it fixes this for you?

@yubaoquan
Copy link

When you make a search vscode selects the word so Vim changes to visual mode.

I don't remember vim has this feature before. If it is designed to have this behavior, how can I config to close this feature?

@J-Fields
Copy link
Member

When you make a search vscode selects the word so Vim changes to visual mode.

I don't remember vim has this feature before. If it is designed to have this behavior, how can I config to close this feature?

No way, currently - sorry, this was a breaking change. I'd suggest either using vim-emulated search / or remain on 1.16.0 until select mode is implemented

@ReedyBear
Copy link
Contributor Author

ReedyBear commented Oct 8, 2020

@berknam

@Taeluf When you say it goes into VIM mode do you mean it goes into Visual Mode?

I meant Normal Mode, where I expect Insert Mode

I tried with v1.17.1:

  • In insert mode -> ctrl+f for vscode's search -> type 'new' & [enter] ->
    • Single click in the editor (on the found text or otherwise), I'm now in normal mode:
      • Press [a] 3 times to go into insert mode
      • Press [y] -> [h] -> [p] & pastes a single character (pretty sure I'm not in visual mode here)
      • Press [h] & cursor moves left one, but nothing is selected
    • Double click in the editor, I'm now in normal mode
      • Press [a] once to go into insert mode
    • Click in the editor in multiple different spots (not a double-click): Same as the single-click behavior
  • For trying to select multiple words with my mouse, I'm getting the same behavior as above

what you're mentioning after making a search, that is expected behavior. When you make a search vscode selects the word so Vim changes to visual mode.

With [ctrl+f], I'm in insert mode before, and it puts me in Normal mode after, which is different from v1.16
With selecting two words with multi-cursor (alt+double-click -> repeat), I am put into Visual mode. This is different from my experience with v1.16 & still is only selecting to the left of the second word, but is selecting the entire first word

I see the other comments that switching to visual mode is a breaking change, so then the actual bugs I can see are that it's going into normal mode, not visual mode with ctrl+f, and that it's only selecting to the left of the cursor when alt+double-clicking the second word.

Can any of you try the PR #5250 to see if it fixes this for you?

Is this integrated into v1.17.1? If not, how would I try the PR? Never installed an extension from outside the vscode extensions marketplace

@ReedyBear
Copy link
Contributor Author

Ope. Okay. So if I search w/ ctrl+f, then click the x to close the search box, that focuses the editor and i AM in visual mode. So I guess that's working as expected, then? Clicking in the editor does seem to... make vim weird?

& there's still the "left of the cursor when alt+double-clicking the second word" issue.

@ReedyBear ReedyBear reopened this Oct 8, 2020
@ReedyBear
Copy link
Contributor Author

(whoops didn't mean to close)

@berknam
Copy link
Contributor

berknam commented Oct 9, 2020

When you make a search and then press <Esc> or close the search box, vscode will leave the searched text selected so VSCodeVim will go to visual mode. When you mouse click somewhere, then you lose the selection and go back to normal mode. This is normal Vim behavior, if you select some text in Vim with mouse click and drag, it puts you in visual mode, if you then click somewhere it goes to normal mode.

This is considering that you have :set mouse=a and :set selectmode="". This extension doesn't yet support this settings or SelectMode, so by default it is implemented as if you have them set like this.

@ReedyBear
Copy link
Contributor Author

Okay, so I guess that closes this issue then.

Regarding the multi-cursor, when I [alt+double-click] the second word, and it only selects to the left of the cursor... Should I open a separate issue? (after searching for an existing one, that is)

@berknam
Copy link
Contributor

berknam commented Oct 9, 2020

Yes that is a different issue. I remember other people talking about it before but I don't think there is an open issue for that.

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