mirror of
https://github.com/jasonwilliams/vscode-helix.git
synced 2024-08-17 04:10:46 +03:00
parent
148d9c661d
commit
1bdab8436d
@ -19,18 +19,26 @@ import { whitespaceWordRanges, wordRanges } from '../word_utils';
|
||||
import KeyMap from './keymaps';
|
||||
|
||||
export const motions: Action[] = [
|
||||
parseKeysExact([KeyMap.Motions.MoveRight], [Mode.Normal, Mode.Visual], (vimState, editor) => {
|
||||
parseKeysExact([KeyMap.Motions.MoveRight], [Mode.Visual], (vimState, editor) => {
|
||||
execMotion(vimState, editor, ({ document, position }) => {
|
||||
return positionUtils.rightNormal(document, position, vimState.resolveCount());
|
||||
});
|
||||
}),
|
||||
|
||||
parseKeysExact([KeyMap.Motions.MoveLeft], [Mode.Normal, Mode.Visual], (vimState, editor) => {
|
||||
parseKeysExact([KeyMap.Motions.MoveLeft], [Mode.Visual], (vimState, editor) => {
|
||||
execMotion(vimState, editor, ({ position }) => {
|
||||
return positionUtils.left(position, vimState.resolveCount());
|
||||
});
|
||||
}),
|
||||
|
||||
parseKeysExact([KeyMap.Motions.MoveRight], [Mode.Normal], () => {
|
||||
vscode.commands.executeCommand('cursorRight');
|
||||
}),
|
||||
|
||||
parseKeysExact([KeyMap.Motions.MoveLeft], [Mode.Normal], () => {
|
||||
vscode.commands.executeCommand('cursorLeft');
|
||||
}),
|
||||
|
||||
parseKeysExact([KeyMap.Motions.MoveUp], [Mode.Normal], (_vimState, _editor) => {
|
||||
vscode.commands.executeCommand('cursorMove', {
|
||||
to: 'up',
|
||||
|
@ -5,6 +5,12 @@ import { Mode } from './modes_types';
|
||||
import { removeTypeSubscription } from './type_subscription';
|
||||
|
||||
export function enterInsertMode(helixState: HelixState): void {
|
||||
// To fix https://github.com/jasonwilliams/vscode-helix/issues/14 we should clear selections on entering insert mode
|
||||
// Helix doesn't clear selections on insert but doesn't overwrite the selection either, so our best option is to just clear them
|
||||
const editor = helixState.editorState.activeEditor!;
|
||||
const activeSelection = editor.selection.active;
|
||||
editor.selections = [new vscode.Selection(activeSelection, activeSelection)];
|
||||
|
||||
helixState.mode = Mode.Insert;
|
||||
setModeContext('extension.helixKeymap.insertMode');
|
||||
helixState.commandLine.setText('', helixState);
|
||||
|
Loading…
Reference in New Issue
Block a user