Skip to content

Commit

Permalink
feat(diff): Adding diff for F key for log/status commands + doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcrites committed Mar 26, 2018
1 parent cdc34de commit ad9d3a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ through these hashes and interact with them using the following key commands:

* <kbd>j</kbd>, <kbd>down</kbd> - select next hash.
* <kbd>k</kbd>, <kbd>up</kbd> - select previous hash.
* <kbd>enter</kbd>, <kbd>d</kbd> - view diff of selected hash.
* <kbd>u</kbd>, <kbd>Page Up</kbd> - move up 5 hashes
* <kbd>d</kbd>, <kbd>Page Down</kbd> - move down 5 hashes
* <kbd>enter</kbd>, <kbd>f</kbd> - view diff of selected hash.
* specifically, this runs `git -c core.pager='less -+F' show -w <commit>`.
* <kbd>c</kbd> - checkout the selected hash.
* <kbd>y</kbd> - copy the selected hash to the clipboard.
Expand All @@ -106,7 +108,12 @@ through these files and interact with them using the following key commands:

* <kbd>j</kbd>, <kbd>down</kbd> - select next file.
* <kbd>k</kbd>, <kbd>up</kbd> - select previous file.
* <kbd>u</kbd>, <kbd>Page Up</kbd> - move up 5 files
* <kbd>d</kbd>, <kbd>Page Down</kbd> - move down 5 files
* <kbd>enter</kbd>, <kbd>e</kbd> - runs `$EDITOR <selected-file>`.
* <kbd>f</kbd> - view diff of the current file
* specifically, this runs `git -c core.pager='less -+F' diff -w <file>`.
* <kbd>x</kbd> - remove the selected file (you are prompted for y/n first).
* <kbd>y</kbd> - copy the selected filename to the clipboard.

*Note:* You must set your `$EDITOR` environment variable to use the editor
Expand Down
2 changes: 1 addition & 1 deletion src/command/LogCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class LogCommand extends Command {

this.navigator.key(['u', 'pageup'], () => this.navigator.navigatePrev(5));

this.navigator.key(['enter'], () => {
this.navigator.key(['enter', 'f'], () => {
this.navigator.clear();
this.program.spawn('git', [
'-c',
Expand Down
11 changes: 11 additions & 0 deletions src/command/StatusCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ export class StatusCommand extends Command {
this.program.copyToClipboard(this.navigator.getSelectedBlock().block);
});

this.navigator.key(['f'], () => {
this.navigator.clear();
this.program.spawn('git', [
'-c',
'core.pager=less -+F',
'diff',
'-w',
this.navigator.getSelectedBlock().block,
]);
});

this.navigator.key(['enter', 'e'], () => {
this.navigator.clear();
this.program.spawn(process.env.EDITOR, [
Expand Down

0 comments on commit ad9d3a3

Please sign in to comment.