C-w to delete word backward in Conkeror

by Ruslan Spivak on September 22, 2010

Long time ago after reading Steve Yegge’s post on Effective Emacs I rebound C-w to ‘backward-kill-word and since then I’ve had the same key binding for both Emacs and BASH.

Now that Conkeror is my default browser it makes sense to have C-w to work the same way as in Emacs and BASH.

This is a snippet that I’ve added to my¬† ~/.conkerorrc

define_key(text_keymap, 'C-w', 'cmd_deleteWordBackward');

Now I have a uniform key binding across my tools.

If you enjoyed this post why not subscribe via email or my RSS feed and get the latest updates immediately. You can also follow me on GitHub or Twitter.

{ 2 comments… read them below or add one }

Kyle Sherman September 29, 2010 at 3:30 PM

In order to have the best-of-both-worlds, I created the following function that I call with C-w:

(defun kill-region-or-word ()
“Call `kill-region’ or `backward-kill-word’ depending on whether or not a region is selected.”
(interactive)
(if (and transient-mark-mode mark-active)
(kill-region (point) (mark))
(backward-kill-word 1)))

(global-set-key “C-w” ‘kill-region-or-word)

Reply

Ruslan Spivak September 30, 2010 at 10:06 AM

Hi Kyle,

That’s really neat. Thanks for sharing the snippet.
I might use it one day if I’m tired of my C-x C-k to kill a region :)

Reply

Speak your mind

Previous post:

Next post: