From c652dd86f62de475ac71671948fb8508e0db5a42 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 5 Mar 2021 17:26:00 -0600 Subject: [PATCH] Add Jump Between And Stage Git Hunks With Fugitive as a vim til --- README.md | 3 ++- ...etween-and-stage-git-hunks-with-fugitive.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 vim/jump-between-and-stage-git-hunks-with-fugitive.md diff --git a/README.md b/README.md index f3dff47..6183f62 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_1070 TILs and counting..._ +_1071 TILs and counting..._ --- @@ -1145,6 +1145,7 @@ _1070 TILs and counting..._ - [Interactive Buffer List](vim/interactive-buffer-list.md) - [Joining Lines Together](vim/joining-lines-together.md) - [Jump Back To The Latest Jump Position](vim/jump-back-to-the-latest-jump-position.md) +- [Jump Between And Stage Git Hunks With Fugitive](vim/jump-between-and-stage-git-hunks-with-fugitive.md) - [Jump To Matching Pair](vim/jump-to-matching-pair.md) - [Jump To The Next Misspelling](vim/jump-to-the-next-misspelling.md) - [List All Buffers](vim/list-all-buffers.md) diff --git a/vim/jump-between-and-stage-git-hunks-with-fugitive.md b/vim/jump-between-and-stage-git-hunks-with-fugitive.md new file mode 100644 index 0000000..bcb33d7 --- /dev/null +++ b/vim/jump-between-and-stage-git-hunks-with-fugitive.md @@ -0,0 +1,18 @@ +# Jump Between And Stage Git Hunks With Fugitive + +Once you [open vim-fugitive's git summary +window](open-the-fugitive-git-summary-window.md), you'll see a listing of the +tracked files with unstaged changes. Each of those files is made up of one or +more _hunks_—a semi-contiguous chunk of changes in a Git diff. + +You can jump forward and backward through these hunks with `]c` and `[c`, +respectively. If the inline diff view of a given file has not already been +expanding, these navigational keybindings will auto-expand it. + +With the cursor over the heading of a particular hunk, you can hit `s` +(assuming you're looking at unstaged changes) to _stage_ the entire hunk. +Similarly, if the cursor is over the hunk heading of a change in the staged +area, you can hit `u` to unstage that entire hunk. + +For more details and a visual walkthrough, [check out this screencast on +staging commits within Vim](https://www.youtube.com/watch?v=41OI6pszvv0).