Vim icon indicating copy to clipboard operation
Vim copied to clipboard

How to disable Visual Mode in VSCodeVim?

Open swyxio opened this issue 6 years ago • 26 comments

Is your feature request related to a problem? Please describe.

Hi! I would like to work without visual mode completely. is it possible to just turn it off somehow?

Describe the solution you'd like

No visual mode

Describe alternatives you've considered

None. i think insert and normal mode are all i need.

thank you!

swyxio avatar Jan 15 '19 02:01 swyxio

Why would you want to disable visual mode?

jpoon avatar Feb 02 '19 06:02 jpoon

because insert and normal mode are good enough for me.. would like an option to do that. or at least disable visual mode with mouse select. in regular vim you can: https://gist.github.com/u0d7i/01f78999feff1e2a8361

its kind of a feature request really. i'll understand if you dont want it. just trying my luck...

swyxio avatar Feb 02 '19 07:02 swyxio

@sw-yx is it visual mode from mouse drag you don't want?

J-Fields avatar Sep 09 '19 06:09 J-Fields

This is definitely something I'd like, Visual mode drives me mad.

EDIT: It'd be nice to auto enable insert mode when selecting tbh...

ElvenSpellmaker avatar Jan 11 '20 22:01 ElvenSpellmaker

vim.mouseSelectionGoesIntoVisualMode: false

J-Fields avatar Jan 12 '20 06:01 J-Fields

So is there no way to disable visual mode altogether?

localhostec avatar Nov 11 '20 16:11 localhostec

So is there no way to disable visual mode altogether?

No, at least not currently. Once select mode is implemented, we could probably add configuration to always use it instead of visual mode.

J-Fields avatar Nov 12 '20 18:11 J-Fields

Recently I'm having real problems with visual mode.

Searching causes it to switch to visual mode (it didn't used to) and then the editor starts behaving oddly and enters a mode where it says normal but behaves oddly and it shows random stuff like this: image

EDIT: I have vim.mouseSelectionGoesIntoVisualMode: false but it doesn't seem to work with searching any more.

ElvenSpellmaker avatar Nov 18 '20 12:11 ElvenSpellmaker

@ElvenSpellmaker

Searching causes it to switch to visual mode (it didn't used to)

Yes, this change was made recently.

then the editor starts behaving oddly and enters a mode where it says normal but behaves oddly and it shows random stuff like this: image

Can you reproduce this? This seems like a bug, I haven't seen this before. Can you create a new issue for this with the reproducing steps?

berknam avatar Nov 20 '20 12:11 berknam

Yes, this change was made recently.

@berknam Oh, is there any way to disable this like with vim.mouseSelectionGoesIntoVisualMode: false? I really never want to enter visual mode, and to be switched out of insert mode when already in it is a real pain as it means I have to unfocus the search term to get to normal and re-enter insert mode again which really slows me down.

Can you reproduce this? This seems like a bug, I haven't seen this before. Can you create a new issue for this with the reproducing steps?

Yeah I can reproduce this, for example I'm in insert mode, I'll search for something which switches to visual mode, I'll click off which turns it back to normal, and then when I press i to go back to insert I get this behaviour.

The characters it shows when I do this seem to be random, for example I'm getting this a lot now when I perform the above steps: image

Sometimes the character string is quite large, if I continue to press i to enter insert mode it'll often dance around the file quite a bit before going into insert in some random place.

ElvenSpellmaker avatar Nov 20 '20 12:11 ElvenSpellmaker

Oh, is there any way to disable this like with vim.mouseSelectionGoesIntoVisualMode: false?

Not currently - sorry. You can stay on 1.16 for now, but that's obviously not ideal. We plan on implementing select mode in the near future (I realized while writing this that we didn't have a ticket for it - just made #5716).

J-Fields avatar Nov 20 '20 19:11 J-Fields

@J-Fields I'm really not sure switching mode even to SELECT will be a solution for me, I'd like to stay in insert when searching like on 1.16. =(

Thanks for the information though!

ElvenSpellmaker avatar Nov 20 '20 19:11 ElvenSpellmaker

What's the difference for your purposes?

J-Fields avatar Nov 20 '20 19:11 J-Fields

Well, maybe I don't understand select mode fully, but in 1.16 I could search for something and click in the editor and still be in insert mode which is far more smooth than having to re-enter insert mode every time I do a search.

Editing Azure DevOps yaml files for example is a search heavy task and having to re-enter modes is really cumbersome (even if the bug mentioned above wasn't a thing).

I've gone back to 1.16 for now thanks. 🙂

ElvenSpellmaker avatar Nov 20 '20 19:11 ElvenSpellmaker

For the record by search I mean the vscode search using ^F

ElvenSpellmaker avatar Nov 20 '20 19:11 ElvenSpellmaker

Do you mean you want to:

  1. Stay in insert mode with the matched text selected (this is essentially what select mode is - technically in vim, you can't have a selection while in insert mode)
  2. Stay in insert mode without the matched text selected (I'm not sure there's a way of doing this)

Playing around with it very briefly in 1.16 suggests that the behavior at that point was 1.

J-Fields avatar Nov 20 '20 20:11 J-Fields

Yeah point 1, assuming select mode is cancelled when I click back in the editor and I'm back in insert mode, then there's no tangible difference I suppose.

I totally understand vim doesn't have the concept of selections in insert mode, but vscode 'does', and vim doesn't have the vscode finder either, so while I can understand wanting to mimic vim's behaviour where possible it'd be nice to take advantage of the power the GUI brings such as their finder and staying in insert mode haha.

As a side point if I select text while in insert mode it doesn't change any modes even in 1.17 and so the abstraction isn't carried the full way through, only for searches (I suppose that's what the above setting disables?).

Basically I love the power of vim for some things and the ease of a GUI-based editor for others and visual mode really breaks my flow (but maybe doesn't for others haha).

ElvenSpellmaker avatar Nov 20 '20 20:11 ElvenSpellmaker

Normal Vim has a '--visual mode-- (insert) ' that is like normal visual mode but after an operation it goes back to insert mode instead of normal mode. This is usually triggered when using shift+arrowKeys. We could implement something like this and have it so when you click when in that InsertVisualMode it would go back to InsertMode. (this is all tied to the 'keymodel' and 'selectmode' settings)

berknam avatar Nov 20 '20 20:11 berknam

2\. Stay in insert mode without the matched text selected (I'm not sure there's a way of doing this)

With PR #5842 this is possible, since if you call the search widget in InsertMode then you'll go into the special pseudo-mode -- (insert) VISUAL -- and after clicking somewhere you'll go back to InsertMode.

Since this sort of selections created by vscode is something that doesn't exist in VIM we need to decide what to do with them. Should they go to Visual mode or Select mode or be dependent on a setting? Currently it is setup to always go to Visual mode but we have this options: Option 1. We could add a possible value of vscode to the setting selectmode that would make these type of selections always trigger Select mode, otherwise they would go to Visual mode Option 2. If we are in normal mode when that selection change happens we trigger Visual mode, if we are in Insert/Replace mode when it happens we trigger Select mode

@ElvenSpellmaker I would like to know your opinion, what do you think would be better for you?

berknam avatar Dec 09 '20 11:12 berknam

Hey @berknam, in my case I'm not sure which option is best, basically as long as when I click back into the editor I was in the mode I was in before then it'll behave like it did before I think.

Most of my searches are using the vscode built-in search which in 1.16 and before would leave me in insert mode when I go from the search box back to the editor either by clicking back in or by pressing ESC in which case the item remains selected in INSERT mode.

ElvenSpellmaker avatar Dec 09 '20 12:12 ElvenSpellmaker

Most of my searches are using the vscode built-in search which in 1.16 and before would leave me in insert mode when I go from the search box back to the editor either by clicking back in or by pressing ESC in which case the item remains selected in INSERT mode.

In that case both options would work for you exactly the same, the only difference being that option 2 would work by default and in option 1 you would have to set the setting "vim.selectmode": "vscode".

But the end result would be that after searching if you clicked somewhere you would be back in InsertMode, if you pressed <Esc> or <Enter> you would get to SelectMode with the searched word selected. This is basically the same as it happened in 1.16, if you start writing it will replace the selection. And if you want it to loose the selection when you move with arrow keys without shift you only need to have stopsel on the setting keymodel.

berknam avatar Dec 09 '20 12:12 berknam

Hi @ElvenSpellmaker! Is it possible to disable jumping into the select mode when using VSCode's standard command+D binding? (Similarly to how vim.mouseSelectionGoesIntoVisualMode: false works) I used this in Sublime to select the word under my cursor and then hitting a bracket or a quotation automatically surrounded that word. It would also work in VSCode if the vim plugin is disabled. It could also work if command+D could behave similarly to a mouse select. For me, it seems much easier than using vim's surrounding keybindings.

divenyijanos avatar Oct 06 '21 08:10 divenyijanos

Hello, and thanks for a great extension! Curious if there's any movement on this, as it's been over a year and the issue is still open but without any chatter. (I have an identical use case as @divenyijanos).

vanderhoop avatar Oct 04 '22 20:10 vanderhoop

I hope there is a setting: "Enter Visual Mode Manually, Not Automatically". Like sw-yx said, insert and normal mode are all I need in most cases, but I still hope to enter Visual Mode manually, that is, press (Shift or Ctrl +) V when I'm in Normal Mode. Here are some situations vim automatically enter Insert Mode but I don't want that happen. (I have unchecked Vim: MouseSelectionGoesIntoVisualMode and checked Vim: Start In Insert Mode. ) Situation 1 When searching text using Ctrl + F. In the picture below, after typing "vim" it automatically switched from Insert mode to Visual mode. Situation 2 When using Emmet: Wrap with Abreviation. It automatically switched from Insert mode to Visual mode.

omymenzies avatar Apr 20 '23 06:04 omymenzies

can some one please help. I am having same issue

nonamecodi avatar Nov 09 '23 18:11 nonamecodi

I really think visual mode makes no sense in visual studio, specially with multi cursors it feels broken, i was really enjoying the extension but no been able to use the native multi cursors is a deal breaker for me.

Gerardo115pp avatar Dec 30 '23 03:12 Gerardo115pp