From 8777a495bc89a822b3ddb16b8044fd82e968610d Mon Sep 17 00:00:00 2001
From: Junegunn Choi <junegunn.c@gmail.com>
Date: Sun, 10 Nov 2013 20:19:57 +0900
Subject: [PATCH] Shift-TAB on multi-select mode

---
 README.md   | 2 +-
 fzf         | 6 ++++--
 fzf.gemspec | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index c67a6e1e..d5764293 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,7 @@ The following readline key bindings should also work as expected.
 - CTRL-W / CTRL-U
 
 If you enable multi-select mode with `-m` option, you can select multiple items
-with TAB key.
+with TAB or Shift-TAB key.
 
 Usage as Vim plugin
 -------------------
diff --git a/fzf b/fzf
index 60bfdaa4..746a973b 100755
--- a/fzf
+++ b/fzf
@@ -542,7 +542,7 @@ begin
       cursor = ridx
     },
     127 => proc { input[cursor -= 1] = '' if cursor > 0 },
-    9 => proc {
+    9 => proc { |o|
       emit(:select) {
         if sel = [*@matches.fetch(@vcursor, [])][0]
           if @selects.has_key? sel
@@ -550,7 +550,7 @@ begin
           else
             @selects[sel] = 1
           end
-          @vcursor = [0, @vcursor - 1].max
+          @vcursor = [0, @vcursor + (o == :stab ? 1 : -1)].max
         end
       } if @multi
     },
@@ -562,6 +562,7 @@ begin
   actions[ctrl(:h)] = actions[127]
   actions[ctrl(:n)] = actions[ctrl(:j)]
   actions[ctrl(:p)] = actions[ctrl(:k)]
+  actions[:stab]    = actions[9]
 
   while true
     # Update user input
@@ -580,6 +581,7 @@ begin
               when 67 then :right
               when 66 then ctrl(:j)
               when 65 then ctrl(:k)
+              when 90 then :stab
               else :nop
               end
       end
diff --git a/fzf.gemspec b/fzf.gemspec
index 8167fea4..c92f181d 100644
--- a/fzf.gemspec
+++ b/fzf.gemspec
@@ -1,7 +1,7 @@
 # coding: utf-8
 Gem::Specification.new do |spec|
   spec.name          = 'fzf'
-  spec.version       = '0.3.0'
+  spec.version       = '0.3.1'
   spec.authors       = ['Junegunn Choi']
   spec.email         = ['junegunn.c@gmail.com']
   spec.description   = %q{Fuzzy finder for your shell}
-- 
GitLab