mirror of
https://github.com/jasonwilliams/vscode-helix.git
synced 2024-10-06 13:17:15 +03:00
Supporting visual mode in some operators
This commit is contained in:
parent
c5e9b183be
commit
5c4ca51485
12
package.json
12
package.json
@ -174,7 +174,17 @@
|
||||
{
|
||||
"key": "alt+;",
|
||||
"command": "extension.helixKeymap.flipSelection",
|
||||
"when": "extension.helixKeymap.normalMode"
|
||||
"when": "!extension.helixKeymap.insertMode && editorTextFocus"
|
||||
},
|
||||
{
|
||||
"key": "alt+k",
|
||||
"command": "editor.action.moveLinesUpAction",
|
||||
"when": "editorTextFocus && !extension.helixKeymap.insertMode"
|
||||
},
|
||||
{
|
||||
"key": "alt+j",
|
||||
"command": "editor.action.moveLinesDownAction",
|
||||
"when": "editorTextFocus && !extension.helixKeymap.insertMode"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
|
@ -53,13 +53,13 @@ export const actions: Action[] = [
|
||||
}),
|
||||
|
||||
// Selection Stuff
|
||||
parseKeysExact(['s'], [Mode.Normal], (helixState, editor) => {
|
||||
parseKeysExact(['s'], [Mode.Normal, Mode.Visual], (helixState, editor) => {
|
||||
enterSelectMode(helixState);
|
||||
// if we enter select mode we should save the current selection
|
||||
helixState.currentSelection = editor.selection;
|
||||
}),
|
||||
|
||||
parseKeysExact([','], [Mode.Normal], (_, editor) => {
|
||||
parseKeysExact([','], [Mode.Normal, Mode.Visual], (_, editor) => {
|
||||
// Keep primary selection only
|
||||
editor.selections = editor.selections.slice(0, 1);
|
||||
}),
|
||||
|
@ -2,7 +2,7 @@ import * as vscode from 'vscode';
|
||||
|
||||
import { Action } from '../action_types';
|
||||
import { HelixState } from '../helix_state_types';
|
||||
import { enterNormalMode, setModeCursorStyle } from '../modes';
|
||||
import { enterNormalMode, enterVisualMode, setModeCursorStyle } from '../modes';
|
||||
import { Mode } from '../modes_types';
|
||||
import { parseKeysOperator } from '../parse_keys';
|
||||
import { operatorRanges } from './operator_ranges';
|
||||
@ -93,11 +93,12 @@ export const operators: Action[] = [
|
||||
if (linewise) {
|
||||
// enterVisualLineMode(vimState);
|
||||
} else {
|
||||
// enterVisualMode(vimState);
|
||||
enterVisualMode(vimState);
|
||||
}
|
||||
|
||||
setModeCursorStyle(vimState.mode, editor);
|
||||
}),
|
||||
|
||||
parseKeysOperator(['q'], operatorRanges, (vimState, editor, ranges, _linewise) => {
|
||||
if (ranges.every((x) => x === undefined) || vimState.mode === Mode.Visual || vimState.mode === Mode.VisualLine) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user