Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved command editing experience #876

Closed
jdfa opened this issue Jul 19, 2022 · 3 comments
Closed

Improved command editing experience #876

jdfa opened this issue Jul 19, 2022 · 3 comments

Comments

@jdfa
Copy link

jdfa commented Jul 19, 2022

I feel that command input is not really user-friendly. For instance, it doesn't allow marking and jumping between words.
Those features are really essential to input commands conveniently.
Same improvements can be also applied to rename command input and any other input request handler.

@UnrealView
Copy link

I agree, currently editing experience is very poor.
It should be great if the input bar can handle some common action in text editor like:

  • ctrl-left/right arrow to navigate word by word
  • ctrl-shift-left/right arrow to select word by word
  • ctrl-delete/backspace to delete word by word
  • ...

These example is common for Windows but maybe it can be configurable.

@ilyagr
Copy link
Collaborator

ilyagr commented Mar 12, 2023

name command input and any other input request handler.

What does this mean?

It should be great if the input bar can handle some common action in text editor like

  • Making <c-left> and <c-right> work is doable. I may or may not do it :). Currently, you can use <a-f> and <a-b> or cmap something else (but not ctrl-arrows, those are not yet supported as far as I can tell).
  • Creating a notion of selection in the command-line would be a pretty big change. The command line does support emacs-style kill and yank if that helps.
  • You can use <c-w> to delete a word and there are other related and useful commands in the docs. Unfortunately, it seems to be difficult to reliably bind <c-backspace> in a terminal app.

ilyagr added a commit to ilyagr/lf that referenced this issue Apr 7, 2023
After the naming scheme from gokcehan#1146, it would seem weird to not have a :cmaps
command. This could help with issues like gokcehan#876.
gokcehan pushed a commit that referenced this issue Apr 8, 2023
* Make `:maps` work on Windows

This makes the `:maps` command from #1146 work on Windows.

This (as well as `:maps` itself) is based on @jackielli's work in #1146 and
#1152.

I intend to refactor the code in this or a separate PR, but I thought I'd
submit the critical and simple bit first.

* Add `:cmaps` command

After the naming scheme from #1146, it would seem weird to not have a :cmaps
command. This could help with issues like #876.
@joelim-work
Copy link
Collaborator

Mapping <c-left> and <c-right> is supported as of #1248

On my terminal backspace is mapped to <backspace2>, and ctrl+backspace is mapped to <backspace>, and the following works for me:

cmap <c-left> cmd-word-back
cmap <c-right> cmd-word
cmap <backspace> cmd-delete-unix-word
cmap <c-delete> cmd-delete-word

Note that cmap mappings apply for both editing commands, and when user input is requested (e.g. rename: and filter: ).

Regarding text selection, lf command line editing is based off GNU Readline, so I'm not sure whether it's worth implementing or whether it's in the correct spirit to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants