down
down copied to clipboard
Support ^W (Ctrl-W)
I use ^W (delete from current character to beginning of current word*) quite a lot in shell or in my text editors. I think it might be good to have it in down as well.
*: a word can more or less be defined as [a-z A-Z 0-9 (unicode alphanums)]+
. I think an implementation that sets _
as a word separator would be especially useful for OCaml code.
Isn't that M-backspace
?
Ping @kit-ty-kate
Mmh, it seems similar but not exactly the same. For instance with emacs I can have the following OCaml program:
let x = print_endline "blah";;
if the cursor is at the end, it will cut in order: ";;
, then blah
, then "
, then endline
, then _
, then print
, then =
, then x
, then let
.
Whereas M-backspace
will cut in order: "blah";;
, then print_endline
, then =
, then x
, then let
.
I think especially for OCaml programs, which use mostly the snake_case naming convention, it makes sense to propose a method of removing words a bit more fine grade.
I think especially for OCaml programs, which use mostly the snake_case naming convention, it makes sense to propose a method of removing words a bit more fine grade.
TBH that feels a bit too fine grained to me. Especially when you have completion at your finger tips. How often to you refine an identifier according to _
segments ? My bet is that this is quite rare.
Isn't ^W as "dumb" kill-word a conventional Unix CLI binding as old as time? (like its friends ^H ^D ^U ^K).
From that perspective, the issue is that what's currently on M-backspace should be on ^W according to a lot of peoples' muscle memory.
According to readline's manual yes. I don't mind adding this. Just not the interpretation @kit-ty-kate wanted w.r.t. to _
.
Got it. Speaking of Readline, I guess the following in Bash shows an everyday comparison of C-w and M-backspace.
$ cat path/to/something
With the cursor after the path, C-w will delete the entire path, whereas M-backspace will delete one path component at a time.