<C-Home> and <C-End> motions

Fixes #6548
This commit is contained in:
Jason Fields 2021-04-26 20:59:18 -04:00
parent dd6d504828
commit e4ab2d0be5
2 changed files with 28 additions and 1 deletions

View File

@ -74,11 +74,21 @@
"command": "extension.vim_home",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
},
{
"key": "ctrl+home",
"command": "extension.vim_ctrl+home",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
},
{
"key": "End",
"command": "extension.vim_end",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
},
{
"key": "ctrl+end",
"command": "extension.vim_ctrl+end",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
},
{
"key": "Insert",
"command": "extension.vim_insert",

View File

@ -1256,7 +1256,7 @@ class MoveNonBlank extends BaseMovement {
@RegisterAction
class MoveNonBlankFirst extends BaseMovement {
keys = ['g', 'g'];
keys = [['g', 'g'], ['<C-Home>']];
isJump = true;
public async execActionWithCount(
@ -1304,6 +1304,23 @@ class MoveNonBlankLast extends BaseMovement {
}
}
@RegisterAction
class EndOfSpecificLine extends BaseMovement {
keys = ['<C-End>'];
public async execActionWithCount(
position: Position,
vimState: VimState,
count: number
): Promise<Position> {
const line = count
? clamp(count - 1, 0, vimState.document.lineCount - 1)
: vimState.document.lineCount - 1;
return new Position(line, 0).getLineEnd();
}
}
@RegisterAction
class MoveWordBegin extends BaseMovement {
keys = ['w'];