Closed maddyblue closed 5 years ago
This appears to be a difference between editline and readline.
Editline:
Ctrl-W em-kill-region em-kill-region (emacs: Ctrl-W) Delete the string from the cursor to the mark and save it to the cut buffer. It is an error if the mark is not set.
—https://www.daemon-systems.org/man/editline.7.html
Readline:
unix-word-rubout (C-w) Kill the word behind point, using white space as a word boundary. The killed text is saved on the kill-ring.
—https://www.gnu.org/software/bash/manual/html_node/Commands-For-Killing.html#Commands-For-Killing
You should be able to fix it for not just Cockroach but all editline based programs with a config like
# ~/.editrc
bind "^W" ed-delete-prev-word
This doesn't appear to work. I made that my ~/.editrc
and ctrl-w still deletes the whole line.
It definitely works for me. Dumb question: you restarted the Cockroach shell after changing editrc, right?
Yup. And tried putting .editrc in the same directory as the binary. Dunno.
Happy to take a look with you if you'd like. Somehow I feel like it's related to your Linux setup. The next step is to put a bare bind
command in your editrc. If your editrc is actually being parsed, you'll see output like this before every prompt:
# You are connected to a temporary, in-memory CockroachDB instance. Your changes
# will not be saved.
#
Standard key bindings
"^@" -> em-set-mark
"^A" -> ed-move-to-beg
"^B" -> ed-prev-char
"^C" -> rl_interrupt
"^D" -> em-delete-or-list
"^E" -> ed-move-to-end
...
root@127.0.0.1:49636/demo>
If you don't see anything like that, strace'ing the shell would be illustrative.
@benesch I have tried your .editrc
thing above and it works for me too. Can you explain to me why making this work for Matt requires implementing secure_getenv
?
The .editrc
recommendation above should now work properly on linux.
This works now.
Pressing ctrl-w deletes a line (which I expect from ctrl-u) instead of a word. Is this intended? If not can it be changed to be a word only? It makes fixing a bad word much more annoying, as I usually delete the entire line due to muscle memory.