2
2

More than 5 years have passed since last update.

pryでlvを使う

Last updated at Posted at 2013-03-04

Rubyのインタラクティブシェルpryで、ページャにlvを使いたい時は、$HOME/.lv に -c を加える。
pry 0.9.12でこれがないとエスケープシーケンスがそのまま出てしまう。

pry/lib/pager.rb
  class SystemPager < Pry::Pager
    def self.default_pager
      pager = ENV["PAGER"] || ""

      # Default to less, and make sure less is being passed the correct options
      if pager.strip.empty? or pager =~ /^less\s*/
        pager = "less -R -S -F -X"
      end

      pager
    end

lessの-Rはraw control sequenceをそのまま通すというもので、これに相当するlvのオプションが-cである。他は相当するlvのオプションがない。
環境変数LVに文字列-cを加えてもよい。


pry-themeを入れて一部のテーマを使うと、pagerに渡った時にブリンクなどの不具合が出ることがあった。今はpryにのみlessを用いている。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2