irb中的单词边界 [英] word boundaries in irb

查看:120
本文介绍了irb中的单词边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Snow Leopard上使用Terminal.

I'm using Terminal on Snow Leopard.

在命令行中,如果我键入了foo.bar.baz.bang.quuz.quux,则当我点击Option-B时,它将逐字向后移动光标-在每个句点都停止,因为它将句点视为单词边界.同样,选项F逐字向前移动.

At the command line, if I've typed foo.bar.baz.bang.quuz.quux, when i tap option-B, it moves the cursor backward word by word -- stopping at every period, because it considers a period to be a word boundary. Likewise, option-F moves forward word by word.

在irb(0.9.5,红宝石1.8.7)中,选项-B和-F也具有此行为,但是句点不再被视为单词边界,这使得这些键盘快捷键的使用率大大降低.

In irb (0.9.5, ruby 1.8.7), option-B and -F also have this behavior, but the period is no longer treated as a word boundary, which makes these keyboard shortcuts significantly less useful.

我该如何更改?

越来越好奇了:在具有相同irb和ruby版本的EC2实例上,句点 被视为单词边界.

Curiouser and curiouser: On an EC2 instance which has the same irb and ruby versions, the period is treated as a word boundary.

推荐答案

这在这里有意义吗?
http://jorgebernal.info/2009/11/18/fixing-snow-leopard-ruby-readline/

Could this be of relevance here?
http://jorgebernal.info/2009/11/18/fixing-snow-leopard-ruby-readline/

在任何情况下,请确保选项B/F实际上已绑定到inputrc文件中的前向和后向单词,就像约翰指出的那样.

In any case make sure option-B/F are actually bound to forward and backward-word in your inputrc files, like John pointed out.

单词边界也由您的语言环境(请参见"locale"命令)确定,更具体地,由LC_CTYPE(字符分类)确定.我认为这不是问题所在,但您可能需要签出并比较语言环境设置,以防万一.

Also word boundaries are determined by your locale (see the "locale" command), and more specifically by LC_CTYPE (character classification). I don't think that's the problem here, but you might want to check out and compare your locale settings just in case.

这篇关于irb中的单词边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆