Skip to content

Commit

Permalink
added z<cr> and z-
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed May 3, 2017
1 parent c227ea7 commit 8aa6aa3
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2883,6 +2883,28 @@ class CommandTopScroll extends BaseCommand {
at: "top"
}
});
return vimState;
}
}

@RegisterAction
class CommandTopScrollFirstChar extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualLine, ModeName.VisualBlock];
keys = ["z", "\n"];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
// In these modes you want to center on the cursor position
// This particular one moves cursor to first non blank char though
vimState.postponedCodeViewChanges.push({
command: "revealLine",
args: {
lineNumber: position.line,
at: "top"
}
});

// Move cursor to first char of line
vimState.cursorPosition = vimState.cursorPosition.getFirstLineNonBlankChar();

return vimState;
}
Expand All @@ -2901,6 +2923,28 @@ class CommandBottomScroll extends BaseCommand {
at: "bottom"
}
});
return vimState;
}
}

@RegisterAction
class CommandBottomScrollFirstChar extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualLine, ModeName.VisualBlock];
keys = ["z", "-"];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
// In these modes you want to center on the cursor position
// This particular one moves cursor to first non blank char though
vimState.postponedCodeViewChanges.push({
command: "revealLine",
args: {
lineNumber: position.line,
at: "bottom"
}
});

// Move cursor to first char of line
vimState.cursorPosition = vimState.cursorPosition.getFirstLineNonBlankChar();

return vimState;
}
Expand Down

0 comments on commit 8aa6aa3

Please sign in to comment.