Skip to content

Add "mouseSelectionGoesIntoVisualModeFromInsert" to allow for insert -> visual transition without changing current behavior. #9594

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,11 @@
"description": "If enabled, dragging with the mouse activates Visual mode.",
"default": true
},
"vim.mouseSelectionGoesIntoVisualModeFromInsert": {
"type": "boolean",
"markdownDescription": "If enabled, dragging with the mouse activates Visual mode even when starting from Insert mode. Requires `vim.mouseSelectionGoesIntoVisualMode` to be true.",
"default": false
},
"vim.disableExtension": {
"type": "boolean",
"description": "Disables the VSCodeVim extension. The extension will continue to be loaded and activated, but Vim functionality will be disabled.",
Expand Down
1 change: 1 addition & 0 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ class Configuration implements IConfiguration {
visualstar = false;

mouseSelectionGoesIntoVisualMode = true;
mouseSelectionGoesIntoVisualModeFromInsert = false;

changeWordIncludesWhitespace = false;

Expand Down
7 changes: 6 additions & 1 deletion src/configuration/iconfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,15 @@ export interface IConfiguration {
visualstar: boolean;

/**
* Does dragging with the mouse put you into visual mode
* Does dragging with the mouse put you into visual mode (except for insert mode)
*/
mouseSelectionGoesIntoVisualMode: boolean;

/**
* Does dragging with the mouse put you into visual mode when you're in insert mode
*/
mouseSelectionGoesIntoVisualModeFromInsert: boolean;

/**
* Includes trailing whitespace when changing word.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
if (
configuration.mouseSelectionGoesIntoVisualMode &&
!isVisualMode(this.vimState.currentMode) &&
this.currentMode !== Mode.Insert
(this.currentMode !== Mode.Insert ||
configuration.mouseSelectionGoesIntoVisualModeFromInsert)
) {
await this.setCurrentMode(Mode.Visual);

Expand Down
1 change: 1 addition & 0 deletions test/testConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class Configuration implements IConfiguration {
matchpairs = '(:),{:},[:]';
visualstar = false;
mouseSelectionGoesIntoVisualMode = true;
mouseSelectionGoesIntoVisualModeFromInsert = false;
changeWordIncludesWhitespace = false;
foldfix = false;
disableExtension = false;
Expand Down