Skip to content
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

added commands for ctrl+arrow navigation #58

Closed
wants to merge 1 commit into from
Closed
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
25 changes: 25 additions & 0 deletions content_scripts/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ const Commands = {
// in this map.
commands: {
// Cursor movement

moveToLastNonEmptyInRow: {
fn: SheetActions.moveToLastNonEmptyInRow.bind(SheetActions),
name: "Move to last non-empty cell in row",
group: "movement",
},
moveToFirstNonEmptyInRow: {
fn: SheetActions.moveToFirstNonEmptyInRow.bind(SheetActions),
name: "Move to first non-empty cell in row",
group: "movement",
},
moveToTopNonEmptyInColumn: {
fn: SheetActions.moveToTopNonEmptyInColumn.bind(SheetActions),
name: "Move to top non-empty cell in column",
group: "movement",
},
moveToBottomNonEmptyInColumn: {
fn: SheetActions.moveToBottomNonEmptyInColumn.bind(SheetActions),
name: "Move to bottom non-empty cell in column",
group: "movement",
},
moveUp: {
fn: SheetActions.moveUp.bind(SheetActions),
name: "Move up",
Expand Down Expand Up @@ -386,6 +407,10 @@ const Commands = {

defaultMappings: {
"normal": {
"moveToLastNonEmptyInRow": "<A-l>",
"moveToFirstNonEmptyInRow": "<A-h>",
"moveToTopNonEmptyInColumn": "<A-k>",
"moveToBottomNonEmptyInColumn": "<A-j>",
// Cursor movement
"moveUp": "k",
"moveDown": "j",
Expand Down
16 changes: 16 additions & 0 deletions content_scripts/sheet_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,22 @@ const SheetActions = {
//
// Movement
//
moveToLastNonEmptyInRow() {
this.typeKeyFn(KeyboardUtils.keyCodes.right, { control: true });
},

moveToFirstNonEmptyInRow() {
this.typeKeyFn(KeyboardUtils.keyCodes.left, { control: true });
},

moveToTopNonEmptyInColumn() {
this.typeKeyFn(KeyboardUtils.keyCodes.up, { control: true });
},

moveToBottomNonEmptyInColumn() {
this.typeKeyFn(KeyboardUtils.keyCodes.down, { control: true });
},

moveUp() {
const keyOptions = (this.mode == "normal") ? {} : { shift: true };
this.typeKeyFn(KeyboardUtils.keyCodes.up, keyOptions);
Expand Down