From 3ab04b28cf330b7579bd2b8e56c17f591581b235 Mon Sep 17 00:00:00 2001
From: Jerome Reybert <jreybert@gmail.com>
Date: Mon, 19 Oct 2015 14:22:11 +0200
Subject: [PATCH] doc: update all docs with new commands

---
 README.md        | 12 +++++++++++-
 doc/vimagit.txt  | 15 +++++++++++++++
 plugin/magit.vim | 21 ++++++++++++++-------
 3 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index e9f9063..ebe1aa2 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,7 @@ Take a look at [TL;DR](#tldr) to start using it immediatly.
 
 * [x] See all your changes, staged changes, untracked/removed/renamed files in one unique buffer.
 * [x] Staged/unstaged/discard changes with one key press, moving the cursor around. Stage at hunk or file level. Line and partial line staging are ongoing.
+* [x] Stage part of hunks, by visual select, lines or selecting bunch of lines with marks.
 * [x] Start to write the commit message in one key press, commit also in one key press.
 * [x] Modify in line the content just before staging it.
 * [x] Visualize stashes. Apply, pop, drop are on going.
@@ -34,7 +35,6 @@ Take a look at [TL;DR](#tldr) to start using it immediatly.
 * [ ] Chase all corner cases. Please remember that vimagit is at an early development stage. If you try vimagit and nothing is working, please don't throw it, fill an issue on github :heart: !
 
 More to come:
-* Partial hunk staging (next release).
 * Vizualize and checkout branches.
 * Go through history, cherry-pick changes.
 * Something is missing? Open an [issue](https://github.com/jreybert/vimagit/issues/new)!
@@ -123,6 +123,8 @@ Following mappings are set locally, for magit buffer only, in normal mode.
 **S**
  * If cursor is in a hunk, stage/unstage hunk at cursor position.
  * If cursor is in diff header, stage/unstage whole file at cursor position.
+ * If some lines in the hunk are selected (using **v**), stage only visual selected lines (only works for staging).
+ * If some lines in the hunk are marked (using **M**), stage only marked lines (only works for staging).
  * When cursor is in "Unstaged changes" section, it will stage the hunk/file.
  * On the other side, when cursor is in "Staged changes" section, it will unstage hunk/file.
 
@@ -131,6 +133,14 @@ Following mappings are set locally, for magit buffer only, in normal mode.
  * When cursor is in "Unstaged changes" section, it will stage the file.
  * On the other side, when cursor is in "Staged changes" section, it will unstage file.
 
+**L**
+ * Stage the line under the cursor.
+
+**M**
+ * Mark the line under the cursor "to be staged".
+ * If some lines in the hunk are selected (using **v**), mark selected lines "to be staged".
+ * To staged marked lines in a hunk, move cursor to this hunk and press **S**.
+
 **DDD**
  * If cursor is in a hunk, discard hunk at cursor position.
  * If cursor is in diff header, discard whole file at cursor position.
diff --git a/doc/vimagit.txt b/doc/vimagit.txt
index 146024e..497c346 100644
--- a/doc/vimagit.txt
+++ b/doc/vimagit.txt
@@ -152,10 +152,15 @@ Following mappings are set locally, for magit buffer only, in normal mode.
   zc,zC     Typing zc on a file will hide its diffs.
 
                                       *vimagit-S*            *magit#stage_hunk(0)*
+                                                           *magit#stage_vselect()*
                                       *vimagit-g:magit_stage_hunk_mapping*
   S         If cursor is in a hunk, stage/unstage hunk at cursor position.
             If cursor is in diff header, stage/unstage whole file at cursor
             position.
+            If some lines in the hunk are selected (see |visual-use|), stage
+            only selected lines (only works for staging).
+            If some lines in the hunk are marked (see |vimagit-M|), stage only
+            these lines (only works for staging).
             When cursor is in "Unstaged changes" section, it will stage the
             hunk/file.
             On the other side, when cursor is in "Staged changes" section, it
@@ -169,6 +174,16 @@ Following mappings are set locally, for magit buffer only, in normal mode.
             On the other side, when cursor is in "Staged changes" section, it
             will unstage file.
 
+                                      *vimagit-L*          *magit#stage_vselect()*
+  L         Stage the line under the cursor (only works for staging)
+
+                                      *vimagit-M*           *magit#mark_vselect()*
+  M
+            Mark the current line to be staged.
+            If some lines in the hunk are selected (see |visual-use|), mark
+            selected lines.
+            To staged marked lines, press S (see |vimagit-S|) in the current
+            hunk.
 
                                     *vimagit-DDD*            *magit#stage_hunk(1)*
                                     *vimagit-g:magit_discard_hunk_mapping*
diff --git a/plugin/magit.vim b/plugin/magit.vim
index 391c94c..8402ed5 100644
--- a/plugin/magit.vim
+++ b/plugin/magit.vim
@@ -68,19 +68,26 @@ execute "nnoremap <silent> " . g:magit_show_magit_mapping . " :call magit#show_m
 " s:magit_inline_help: Dict containing inline help for each section
 let s:magit_inline_help = {
 			\ 'staged': [
-\'S      if cursor in diff header, unstage file',
+\'S      if cursor on filename header, unstage file',
 \'       if cursor in hunk, unstage hunk',
-\'F      if cursor in diff header or hunk, unstage file',
+\'F      if cursor on filename header or hunk, unstage whole file',
 \],
 			\ 'unstaged': [
-\'S      if cursor in diff header, stage file',
+\'S      if cursor on filename header, stage file',
 \'       if cursor in hunk, stage hunk',
-\'F      if cursor in diff header or hunk, stage file',
+\'       if visual selection in hunk (with v), stage selection',
+\'       if lines marked in hunk (with M), stage marked lines',
+\'L      stage the line under the cursor',
+\'M      if cursor in hunk, mark line under cursor "to be staged"',
+\'       if visual selection in hunk (with v), mark selected lines "to be'
+\'       staged"',
+\'F      if cursor on filename header or hunk, stage whole file',
 \'DDD    discard file changes (warning, changes will be lost)',
 \'I      add file in .gitgnore',
 \],
 			\ 'global': [
-\'C CC   set commit mode to normal, and show "Commit message" section',
+\'<CR>   if cursor on filename header line, unhide diffs for this file',
+\'CC     set commit mode to normal, and show "Commit message" section',
 \'CA     set commit mode amend, and show "Commit message" section with previous',
 \'       commit message',
 \'CF     amend staged changes to previous commit without modifying the previous',
@@ -93,8 +100,8 @@ let s:magit_inline_help = {
 \'You will still be able to toggle inline help with h',
 \],
 			\ 'commit': [
-\'C CC   commit all staged changes with commit mode previously set (normal or',
-\':w<cr> amend) with message written in this section',
+\'CC,:w  commit all staged changes with commit mode previously set (normal or',
+\'       amend) with message written in this section',
 \],
 \}
 
-- 
GitLab