aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2008-04-15 18:33:13 +0000
committerokan2008-04-15 18:33:13 +0000
commit00cd3801d9c4a25c527a378add86c705efa671d6 (patch)
treecd427154749fbdd3314e278be72f94b6f91e7764
parent610683e4362bfb1cd12731e70b8628dec527ccfe (diff)
downloadcwm-00cd3801d9c4a25c527a378add86c705efa671d6.tar.gz
- add vi keybindings to search
- allow for ctrl-h as well discussion with and ok oga@
-rw-r--r--cwm.114
-rw-r--r--input.c21
2 files changed, 28 insertions, 7 deletions
diff --git a/cwm.1 b/cwm.1
index f029ef9..29daa45 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.26 2008/04/08 14:12:28 okan Exp $
+.\" $OpenBSD: cwm.1,v 1.27 2008/04/15 18:33:13 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -15,7 +15,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The following requests are required for all man pages.
-.Dd $Mdocdate: April 8 2008 $
+.Dd $Mdocdate: April 15 2008 $
.Dt CWM 1
.Os
.Sh NAME
@@ -177,17 +177,19 @@ The window is hidden.
.Pp
The following keybindings may be used to navigate the result list:
.Pp
-.Bl -tag -width "[Down] or C-sXXX" -offset indent -compact
-.It Ic [Down] No or Ic C-s
+.Bl -tag -width "[Down] or C-s or M-j" -offset indent -compact
+.It Ic [Down], C-s No or Ic M-j
Select the next window in the list.
-.It Ic [Up] No or Ic C-r
+.It Ic [Up], C-r No or Ic M-k
Select the previous window in the list.
+.It Ic [Backspace] No or Ic C-h
+Backspace.
.It Ic C-u
Clear the input.
.It Ic [Enter]
Focus the selected window.
.It Ic [Esc]
-Quit.
+Cancel.
.It Ic C-a
Whenever there are no matching windows, list every window.
.El
diff --git a/input.c b/input.c
index d2d4b6b..28c973b 100644
--- a/input.c
+++ b/input.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: input.c,v 1.4 2008/01/11 16:06:44 oga Exp $
+ * $Id: input.c,v 1.5 2008/04/15 18:33:13 okan Exp $
*/
#include "headers.h"
@@ -70,6 +70,10 @@ input_keycodetrans(KeyCode kc, u_int state,
case XK_U:
*ctl = CTL_WIPE;
break;
+ case XK_h:
+ case XK_H:
+ *ctl = CTL_ERASEONE;
+ break;
case XK_a:
case XK_A:
*ctl = CTL_ALL;
@@ -77,6 +81,21 @@ input_keycodetrans(KeyCode kc, u_int state,
}
}
+ if (*ctl == CTL_NONE && (state & Mod1Mask)) {
+ switch (ks) {
+ case XK_j:
+ case XK_J:
+ /* Vi "down" */
+ *ctl = CTL_DOWN;
+ break;
+ case XK_k:
+ case XK_K:
+ /* Vi "up" */
+ *ctl = CTL_UP;
+ break;
+ }
+ }
+
if (*ctl != CTL_NONE)
return (0);