cuspy memo


zsh colors

2008/04/25 Friday 23:47:55

zsh の colors が便利、これを使うと .zshrc が大分シンプルになった。
通常赤色を表示する場合

% echo -e “\e[31mhello"

という記号めいた文字を記述しなければならないが、zsh の colors を使うと

% autoload -U colors
% colors

というように有効化して

% echo -e "${fg[red]}hello”

で赤色の文字が表示される。バックグラウンドを赤色にするには

% echo -e “${bg[red]}hello”

foreground と background を一般化すると

% echo -e “\e[${color[red]}mhello”
% echo -e “\e[${color[bg-red]}mhello”

でも良い。
使用出来るキーは

% echo $color
none normal bg-blue 31 bold no-standout bg-magenta faint no-underline bg-cyan standout no-blink bg-white underline 33 41 01 blink no-reverse bg-default 27 no-conceal reverse conceal 30 31 08 39 02 32 24 45 35 05 34 30 39 47 black 23 red green 43 yellow 36 blue magenta 37 cyan 03 white 44 35 default 40 28 07 46 04 33 37 40 22 34 42 00 30 30 25 49 bg-black 36 32 bg-red bg-green bg-yellow

で確認出来た。

  1. Robert wrote related post…

    Silk posts and stories…

    Trackback by Robert wrote related post — 2008/06/19 Thursday @ 17:43:41

Leave a comment

You must be logged in to post a comment.

hoge

git に入門する。

2008/04/12 Saturday 04:50:27

いい加減、太古のバージョン管理システムCVS から脱却したいので git への完全移行を目指す。Software Design の4月号に git の記事があったのでざっと読んでみた。git のフロントエンドは cogito を使うのが一般的かと思ってたんだけど、最近はそうでもないらしいので素の git の使い方を覚えることにした。

% apt-get install git-core

として git を実行すると、

[hamano@kujira]% git
git, the filemanager with GNU Interactive Tools, is now called gitfm.

If you are looking for git, Linus Torvald’s content tracker, install
the cogito and git-core packages and see README.Debian and git(7).

This transition script will be removed in the debian stable
release after etch.

If you wish to complete the transition early, install git-core
and use (as root):
update-alternatives –config git

Press RETURN to run gitfm

こんな感じで怒られるけど、これは GNU Interactive Tools が同じ git コマンドだかららしい。

% update-alternatives –config git

There are 2 alternatives which provide `git’.

Selection Alternative
———————————————–
*+ 1 /usr/bin/git.transition
2 /usr/bin/git-scm

Press enter to keep the default[*], or type selection number:

ここで2ばんを選ぶと本当に使いたい git が使えるようになった。

手始めに .zshrc や .emacs などのホームディレクトリ以下の設定ファイルを git で管理してみる。通常のソースコードの管理と違うのは

% git clone /git/dotfiles.git ~
destination directory ‘/home/hamano’ already exists.

というように設定ファイル群をホームディレクトリ以下にぶちまけようと思っても既にディレクトリが存在していると失敗してしまう。なので

% git clone –bare /git/dotfiles.git ~/.git
% git checkout

というように –bare オプションを付けて裸の .git レポジトリをホームディレクトリに置いて checkout するとよさそうだけど、残念なことに origin ブランチが無い事に気がついた。origin ブランチを手動で追加する方法が解らなかったので(.git/remotes/を直接触れば出来そう、1.5以降では git remote というサブコマンドが在るようだ)

% git clone /git/dotfiles.git tmp
% mv tmp/.git ~
% git checkout

というようにしてホームディレクトリ以下に設定ファイルを展開した。これで git pull で origin ブランチとの同期が取れるようになった。
これからじわじわと git に移行していく予定。

  1. Robert wrote related post…

    Silk posts and stories…

    Trackback by Robert wrote related post — 2008/06/19 Thursday @ 22:06:54

Leave a comment

You must be logged in to post a comment.

hoge