URxvt 技巧一则

你在编译一个程序,结果某个未知错误导致编译失败。这时你希望把错误信息复制并粘贴 到网页浏览器中。碰到这种情况,基本上都是用鼠标选择错误信息,然后切换到浏览器用 中键粘贴。

这个技巧就是教你省略鼠标只靠键盘完成上述动作。操作很简单,但是我想大多数人都没 留意。在 make 命令执行结束,你看到 error/failed 等关键字的时候,按下 M-s,输入 error/failed 等错误关键字,Up/Down 用于检索关键字位置,通过正则表达式匹配你感 兴趣的错误信息,然后按下 Shift-Enter,此时高亮显示的字符串就被复制下来了。

剩下的交给 Shift-Insert 粘贴就可以了。

参考: man urxvtperl

while "Enter" or "Return" stay at the current position and additionally stores the first match in the current line into the primary selection if the "Shift" modifier is active.

Read More:

13 Comments

  1. 1 GunsNRose Commented @ 2009-08-27 11:07Reply to this comment

    沙发,赞一个

  2. 2 lerosua Commented @ 2009-08-27 11:18Reply to this comment

    非常好的技巧,没研究明白怎么复制一行

  3. 3 jianlee Commented @ 2009-08-27 11:31Reply to this comment

    通常我都想办法让鼠标选择的区域就可以用 Shift+Insert 粘贴

    http://jianlee.ylinux.org/计算机/常用软件/urxvt.html#sec5

  4. 4 huangda1982 Commented @ 2009-08-27 13:07Reply to this comment

    虽然我平时挺装的,不过其实挺菜的。 那个是啥呀?

  5. 5 huangda1982 Commented @ 2009-08-27 13:10Reply to this comment

    我是说那个M-s是啥呀。

  6. 6 vern Commented @ 2009-08-27 13:32Reply to this comment

    @huangda1982: M-s 是 Meta-s 的缩写,一般 Meta 对应 Alt 键

    @lerosua: 选取一行可以用正则表达式 foo.*

    用这个方法不能选取中文

  7. 7 Moligaloo Commented @ 2009-08-27 14:05Reply to this comment

    @huangda1982 阁下肯定没用过 Emacs

  8. 8 Fwolf Commented @ 2009-08-27 14:10Reply to this comment

    很好用,至少在输出中找东西方便了, 复制可以用鼠标

  9. 9 kidfruit Commented @ 2009-08-27 15:13Reply to this comment

    好技巧。不过实际编译出错搜一下就有结果了……一般发帖子效率很低……

  10. 10 Carlos Commented @ 2009-08-27 16:19Reply to this comment

    make > make.txt ???

  11. 11 simsilver Commented @ 2009-08-27 20:23Reply to this comment

    好技巧,不过中英文混杂的时候可以通过英文来定位再选中文

  12. 12 lxfancy Commented @ 2009-08-28 9:46Reply to this comment

    lerosua Commented @ 2009-08-27 11:18

    非常好的技巧,没研究明白怎么复制一行

    ----正则式匹配嘛,用.*就行

  13. 13 gashero Commented @ 2009-09-01 15:07Reply to this comment

    ion2用户愤怒飘过…… 给我开了一个新的frame。