You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

KSH 93u+(RHEL环境)emacs模式下Ctrl+方向键跳词配置需求

Configure Ctrl+Arrow Word Navigation in ksh 93u+ (RHEL)

Hey there, since you already have the keybind function set up for Home/End/Delete, adding Ctrl+left/right arrow word jumps is straightforward. Here's how to get it working smoothly:

Step 1: Identify Your Terminal's Ctrl+Arrow Escape Sequences

First, you need to know what escape codes your terminal sends when you press Ctrl+left or Ctrl+right arrow. To check this:

cat -v

Press Ctrl+Left Arrow, then hit Ctrl+D to exit cat. You’ll see output like ^[[1;5D (common for xterm/gnome-terminal) or ^[OD (used in some older terminals). Repeat this for Ctrl+Right Arrow—you’ll get something like ^[[1;5C or ^[OC.

Step 2: Bind Sequences to Word Navigation Commands

ksh 93 has built-in editing commands for word jumps: backward-word (matches the functionality of Alt+b) and forward-word (matches Alt+f). Use your existing keybind function to map the Ctrl+arrow sequences to these commands:

# Bind Ctrl+Left Arrow to jump left by word
keybind '^[[1;5D' backward-word
# Fallback for terminals that send this alternate sequence
keybind '^[OD' backward-word

# Bind Ctrl+Right Arrow to jump right by word
keybind '^[[1;5C' forward-word
# Fallback for alternate terminal sequences
keybind '^[OC' forward-word

Test these immediately by pressing Ctrl+left/right in your ksh session—you should jump between whole words as expected.

Step 3: Make Bindings Permanent

To keep these shortcuts active every time you launch ksh, add the above keybind lines to your ~/.kshrc file. Save the file, then either restart your shell or run:

source ~/.kshrc

to apply the changes right away.

Quick Note on Your Duplicate End Bindings

Having two bindings for the End key is totally normal—it’s just covering different escape sequences that various terminals might send for the End key. No need to adjust this unless you notice unexpected behavior.

内容的提问来源于stack exchange,提问作者Matt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:38:34