10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacOSX の less で色付け

Last updated at Posted at 2017-06-12

をしようとして、確認。

$ brew info source-highlight
source-highlight: stable 3.1.8 (bottled)
Source-code syntax highlighter
https://www.gnu.org/software/src-highlite/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/source-highlight.rb
==> Dependencies
Required: boost ✘

おおっと、やっぱりか。

$ brew install source-highlight
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (caskroom/cask, homebrew/core).
==> New Formulae
<snip>
==> Installing source-highlight
==> Downloading https://homebrew.bintray.com/bottles/source-highlight-3.1.8_5.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring source-highlight-3.1.8_5.el_capitan.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/source-highlight/3.1.8_5: 422 files, 6MB

終了。

あれ? src-hilite-lesspipe.sh は何処?

$ find . -name src-hilite-lesspipe.sh -print 2>/dev/null
./usr/local/bin/src-hilite-lesspipe.sh
./usr/local/Cellar/source-highlight/3.1.8_5/bin/src-hilite-lesspipe.sh

へぇ、ここに配置されたのかぁ。
~/.bashrc に、

export LESSOPEN='| /usr/local/bin/src-hilite-lesspipe.sh %s'
export LESS='-gj10 --no-init --quit-if-one-screen --RAW-CONTROL-CHARS'

を指定しました。

10
11
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
10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?