Pages: Welcome | Projects

Ctrl-W

2017/2/23
Tags: [ GNU/Linux ]

I use ZSH on my system (a bare-bone configuration, but still useful for many things). On remotes system though I don't want to spend time setting it up, especially if we are talking about virtual machines and such. I prefer to adapt a little to BASH.

I always set up the vi-mode (set -o vi) in order to get my beloved editor's bindings. The only missing thing now is getting rid of the right amount of words when using ^W. Bash will throw away the whole thing to the space, and if I'm writing a path to a file, that sucks…

I found this one, which I summarize quickly here:

stty werase undef
bind '\C-w:unix-filename-rubout'

I shall investigate more on how the stty thing works :) For the moment I'm happy: the fix does a fantastic job.