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

fix(bindings): Avoid clobbering readline #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rpatterson
Copy link

Readline provides a pretty powerful set of command-line searching and editing features
that can greatly increase CLI efficiency. The readline library is also supported by
many interactive prompts, including language interactive REPLs. Finally, many other
tools emulate readline bindings for similar tasks. Given how frequently it can be used
and that it's used in the inner loop of command-line usage, its usage should be very
fast and as such every effort should be made to avoid adding any delay to it's bindings,
such as repeating the tmux prefix. Ctrl-a is a particularly common and useful
readline binding, for example:

  1. Ctrl-r ... to find a long command in shell history
  2. Ctrl-a to jump to the beginning of the command
  3. M-f to jump one word forward past the root command
  4. Add a CLI option to the command
  5. RET to run the command

Throughout my years with screen, tmux, various editors and rich readline usage, I've
tried a number of prefixes and I agree with many others that Ctrl-z is the best
prefix. Suspending a process is an uncommon task relative to readline usage and the
double-prefix is fine for that task in my experience.

Readline provides a pretty powerful set of command-line searching and editing features
that can greatly increase CLI efficiency.  The readline library is also supported by
many interactive prompts, including language interactive REPLs.  Finally, many other
tools emulate readline bindings for similar tasks.  Given how frequently it can be used
and that it's used in the inner loop of command-line usage, its usage should be very
fast and as such every effort should be made to avoid adding any delay to it's bindings,
such as repeating the tmux prefix.  `Ctrl-a` is a particularly common and useful
readline binding, for example:

1. `Ctrl-r ...` to find a long command in shell history
2. `Ctrl-a` to jump to the beginning of the command
3. `M-f` to jump one word forward past the root command
4. Add a CLI option to the command
5. `RET` to run the command

Throughout my years with screen, tmux, various editors and rich readline usage, I've
tried a number of prefixes and I agree with many others that `Ctrl-z` is the best
prefix.  Suspending a process is an uncommon task relative to readline usage and the
double-prefix is fine for that task in my experience.
The `C-t` binding in readline is to transpose 2 characters and is possibly the least
useful readline CLI editing feature.  Thus it is often used as a tmux/screen prefix.  In
particular it's useful as a prefix for nested remote sessions.
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

Successfully merging this pull request may close these issues.

1 participant