down icon indicating copy to clipboard operation
down copied to clipboard

Support ^W (Ctrl-W)

Open kit-ty-kate opened this issue 4 years ago • 7 comments

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.

kit-ty-kate avatar Nov 10 '19 17:11 kit-ty-kate

Isn't that M-backspace ?

dbuenzli avatar Nov 11 '19 09:11 dbuenzli

Ping @kit-ty-kate

dbuenzli avatar Dec 03 '19 10:12 dbuenzli

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.

kit-ty-kate avatar Dec 03 '19 11:12 kit-ty-kate

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.

dbuenzli avatar Jan 07 '20 23:01 dbuenzli

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.

frou avatar Mar 22 '20 20:03 frou

According to readline's manual yes. I don't mind adding this. Just not the interpretation @kit-ty-kate wanted w.r.t. to _.

dbuenzli avatar Mar 22 '20 21:03 dbuenzli

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.

frou avatar Mar 22 '20 22:03 frou