在Less inside Screen中忽略linenumber的选择

时间:2009-07-08 21:10:20

标签: gnu-screen

我想为Screen开发一个选择工具,忽略选择中的前导空格和数字。

问题

  1. 在屏幕中影响选择工具C-a Esc的代码是什么?
  2. 制作一个算法,从选择开始忽略亚麻布和空间:
  3. alt text http://files.getdropbox.com/u/175564/%20selection-less.png

    以下Perl-regex似乎与行的开头匹配

     {5}[1-9]{1-4} {8}         # not tested
    

    选择工具显然可以通过将选择的增加与当前选择连接起来。例如,选择一行。我选择另一个:在选择队列中添加一个新行。反之亦然,选择减少。

    我想在选择结果\n时使用Perl正则表达式,以便考虑对行的无知。

1 个答案:

答案 0 :(得分:5)

我想你想要选择列。这比正则表达容易得多。

来自screen联机帮助页:

   c or C to set the left or right margin respectively. If no
     repeat  count is  given,   both default  to the  current
     cursor position.
     Example: Try this on a  rather full text screen:  "C-a [
     M 20 l SPACE c 10 l 5 j C SPACE".

     This moves one  to the middle line of  the screen, moves
     in  20 columns left,  marks the  beginning of  the paste
     buffer, sets the left column, moves 5 columns down, sets
     the right  column, and then  marks the end of  the paste
     buffer. Now try:
     "C-a [ M 20 l SPACE 10 l 5 j SPACE"

     and notice the difference in the amount of text copied.

因此,在屏幕截图中,按C-a [,将光标移动到文字的开头,按SPACE,然后按c。移至所选内容的末尾,然后再次按SPACE。现在你有了你想要的文字。

希望这不是太多的信息。你用初学者标记它,所以我不确定你是不是一个perl或屏幕初学者。

相关问题