From e4ab2d0be53f670180803f0e35dfddebf4c0aa3f Mon Sep 17 00:00:00 2001 From: Jason Fields Date: Mon, 26 Apr 2021 20:59:18 -0400 Subject: [PATCH] `` and `` motions Fixes #6548 --- package.json | 10 ++++++++++ src/actions/motion.ts | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a657345ce..a9c203c57 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/actions/motion.ts b/src/actions/motion.ts index b39d71827..251295052 100644 --- a/src/actions/motion.ts +++ b/src/actions/motion.ts @@ -1256,7 +1256,7 @@ class MoveNonBlank extends BaseMovement { @RegisterAction class MoveNonBlankFirst extends BaseMovement { - keys = ['g', 'g']; + keys = [['g', 'g'], ['']]; isJump = true; public async execActionWithCount( @@ -1304,6 +1304,23 @@ class MoveNonBlankLast extends BaseMovement { } } +@RegisterAction +class EndOfSpecificLine extends BaseMovement { + keys = ['']; + + public async execActionWithCount( + position: Position, + vimState: VimState, + count: number + ): Promise { + 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'];