# [PATCH] gitk: map / to focus the search box

3 messages from 2008-11-23 to 2008-12-02. Participants: Giuseppe Bilotta, Paul Mackerras.
Thread: https://gitlist.dev/t/16432

## Giuseppe Bilotta, 2008-11-23 17:01

Subject: [PATCH] gitk: map / to focus the search box
Message-ID: <1227459690-9896-1-git-send-email-giuseppe.bilotta@gmail.com>
URL: https://gitlist.dev/e/1227459690-9896-1-git-send-email-giuseppe.bilotta%40gmail.com

```
The / key is often used to initiate searches (less, vim, some web
browsers). We change the binding for the / (slash) key from 'find next'
to 'focus the search box' to follow this convention.
---
 gitk-git/gitk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 6b671a6..8b60632 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2271,7 +2271,7 @@ proc makewindow {} {
     bindkey b prevfile
     bindkey d "$ctext yview scroll 18 units"
     bindkey u "$ctext yview scroll -18 units"
-    bindkey / {dofind 1 1}
+    bindkey / {focus $fstring}
     bindkey <Key-Return> {dofind 1 1}
     bindkey ? {dofind -1 1}
     bindkey f nextfile
-- 
1.5.6.5

```

## Paul Mackerras, 2008-12-01 22:33

Subject: Re: [PATCH] gitk: map / to focus the search box
Message-ID: <18740.26151.55900.953153@cargo.ozlabs.ibm.com>
URL: https://gitlist.dev/e/18740.26151.55900.953153%40cargo.ozlabs.ibm.com
In-Reply-To: <1227459690-9896-1-git-send-email-giuseppe.bilotta@gmail.com>

```
Giuseppe Bilotta writes:

> The / key is often used to initiate searches (less, vim, some web
> browsers). We change the binding for the / (slash) key from 'find next'
> to 'focus the search box' to follow this convention.

I think that's reasonable, but the patch needs to update the key
bindings help text as well.

Thanks,
Paul.

```

## Giuseppe Bilotta, 2008-12-02 01:19

Subject: [PATCH] gitk: map / to focus the search box
Message-ID: <1228180762-15739-1-git-send-email-giuseppe.bilotta@gmail.com>
URL: https://gitlist.dev/e/1228180762-15739-1-git-send-email-giuseppe.bilotta%40gmail.com
In-Reply-To: <18740.26151.55900.953153@cargo.ozlabs.ibm.com>

```
The / key is often used to initiate searches (less, vim, some web
browsers). We change the binding for the / (slash) key from 'find next'
to 'focus the search box' to follow this convention.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---

Like this?

 gitk-git/gitk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 6b671a6..0c0350b 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2271,7 +2271,7 @@ proc makewindow {} {
     bindkey b prevfile
     bindkey d "$ctext yview scroll 18 units"
     bindkey u "$ctext yview scroll -18 units"
-    bindkey / {dofind 1 1}
+    bindkey / {focus $fstring}
     bindkey <Key-Return> {dofind 1 1}
     bindkey ? {dofind -1 1}
     bindkey f nextfile
@@ -2652,7 +2652,7 @@ proc keys {} {
 [mc "<%s-F>		Find" $M1T]
 [mc "<%s-G>		Move to next find hit" $M1T]
 [mc "<Return>	Move to next find hit"]
-[mc "/		Move to next find hit, or redo find"]
+[mc "/		Focus the search box"]
 [mc "?		Move to previous find hit"]
 [mc "f		Scroll diff view to next file"]
 [mc "<%s-S>		Search for next hit in diff view" $M1T]
-- 
1.5.6.5

```
