在irb中的命令行上导航

时间:2011-10-20 13:28:02

标签: ruby-on-rails ruby irb

我看过用户正在运行irb的截屏视频,当他们写文字时,他们跳转到行的开头/结尾和单词的开头/结尾。用于执行此操作的击键是什么?它取决于正在使用的shell吗?

2 个答案:

答案 0 :(得分:4)

Ctrl + A => Move to beginning of line
Ctrl + E => Move to end of line 

这些是readline命令

以下是您可能会发现有用的cheatsheet

答案 1 :(得分:3)

这些是readline快捷方式。我经常使用的一些快捷方式:

Ctrl + a => End of line
Ctrl + e => Start of line
Ctrl + l => Clear screen
Ctrl + k => Cut text from cursor position till end of line
Ctrl + u => Cut text from cursor position till start of line
Ctrl + y => Paste text that was cut using above two shortcuts
Ctrl + d => Delete a letter after cursor
Ctrl + h => Delete a letter before cursor
Meta + d => Delete the word after cursor
Meta + f => Move cursor one word forward
Meta + b => Move cursor one word backwards.