Showing posts with label Vim. Show all posts
Showing posts with label Vim. Show all posts

Wednesday, May 16, 2007

Macでいろいろ対応したVim7.1(gvim)のインストール

以前のエントリにて、

普段 MacPorts 版の Vim7 を利用しているのだが、いつのまにか gvim がビルドされなくなっているようだ。

なんて言っていたのだが、実は、vim-app として分かれていただけだった。

% port info vim-app
vim-app 7.1.000, editors/vim-app (Variants: universal, big, huge, multibyte, xim, perl, python, ruby, tcl, cscope, darwin_i386)
http://www.vim.org/

This port provides Vim.app, a GUI version of the famous editor vim. Vim is a highly configurable text editor built to enable efficient text editing.

Library Dependencies: gettext, ncurses
Platforms: darwin freebsd
Maintainers: raimue@codingfarm.de

ただし、相変わらず日本語のインライン入力には対応しておらず、我々日本人にとって常用できるレベルのものでは無い。

そこで、様々なパッチを適用した Local Portfile を公開してるがいらっしゃったので、ありがたく使わせていただくことにする。

何に対応しているのかというと、

  • 日本語のインライン入力
  • migemo
  • アンチエイリアス / ATSUI
  • 半透明

と、至れり尽くせり。

今回、Local Portfile を利用するのは初めてなので、自前の Portfile の作り方・使い方 を参考にしながら Local Ports Repository を構築する。

% sudo mkdir /opt/local/var/db/dports/sources/private
% cd /opt/local/var/db/dports/sources/private
% sudo mkdir `ls -F1 /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/ | grep '\/$'`
% sudo vi /opt/local/etc/ports/source.conf
# To enable your local ports repository, uncomment and customize the
# following line to point at your local dports directory
# Example: file:///Users/landonf/misc/darwinports/dports
#
# To get darwinports from the darwinports rsync server use:
# rsync://rsync.darwinports.org/dpupdate/dports
file:///opt/local/var/db/dports/sources/private
rsync://rsync.darwinports.org/dpupdate/dports

予め、以下の Portfile をダウンロードしておきます。

% sudo tar jxvf ~/src/cmigemo.1.3c_3.tbz2
textproc/cmigemo/
textproc/cmigemo/files/
textproc/cmigemo/files/patch-config.mk.diff
textproc/cmigemo/files/patch-config.mk.in.diff
textproc/cmigemo/files/patch-config_default.mk.diff
textproc/cmigemo/files/patch-dict.mk.diff
textproc/cmigemo/files/patch-Make_osx.mk.diff
textproc/cmigemo/Portfile

% sudo tar jxvf ~/src/vim7.1.000.0.tbz2
editors/vim/
editors/vim/Portfile
editors/vim/files/
editors/vim/files/GVim_app.tar.gz
editors/vim/files/atsui+inline.diff
editors/vim/files/checksums_dist
editors/vim/files/checksums_patch
editors/vim/files/gvim.sh
editors/vim/files/gvimrc
editors/vim/files/patch-Info.plist
editors/vim/files/transparency.diff
editors/vim/files/vimrc

% sudo portindex
Creating software index in /opt/local/var/db/dports/sources/private
Adding port editors/vim
Adding port textproc/cmigemo

Total number of ports parsed:   2 
Ports successfully parsed:      2        
Ports failed:                   0

インストール済みのMacPorts版Vimは削除しておいてから、LocalPorts版Vimをインストールします。

% sudo port install cmigemo +utf8
--->  Installing cmigemo 1.3c_3+utf8
--->  Activating cmigemo 1.3c_3+utf8
--->  Cleaning cmigemo

% sudo port install vim +huge +kaoriya +cscope +ruby +aqua +macvim
--->  Fetching vim
--->  Verifying checksum(s) for vim
--->  Extracting vim
--->  Configuring vim
--->  Building vim with target all
--->  Staging vim into destroot
--->  Installing vim 7.1.000_0+aqua+cscope+darwin_i386+huge+kaoriya+macvim+ruby
--->  Activating vim 7.1.000_0+aqua+cscope+darwin_i386+huge+kaoriya+macvim+ruby
--->  Cleaning vim

これで完成です。

かなり良いですね。

フォントも綺麗になったし、半透明は嬉しいし、migemoは便利だし。

PrivatePortfile公開ありがとうございます > sakamoto

関連URL

2007/05/31 修正

Local Port Repository のパスを ~/src/ports から /opt/local/var/db/dports/sources/private に変更。

Tuesday, May 15, 2007

Vim 7.1 リリース

いつの間にか Vim 7.1 がリリースされています。

何が変わったのかというと、

There are many bug fixes and updated runtime files. No amazing new features.

だそうです。。。

MacPorts にも既に登録されています。はやっ。

Sunday, April 29, 2007

コーヒー飲みながら Vi を覚える

こんなの発見。via. Digg

Vi 覚えなければいけない新人さん向け。ちょっと欲しい。

Saturday, April 28, 2007

Macでインライン入力に対応したVim7(gvim)を作成するスクリプト(7.0.216)

普段 MacPorts 版の Vim7 を利用しているのだが、いつのまにか gvim がビルドされなくなっているようだ。

MacPorts 版 gvim はインライン入力に対応していなかったのだが、SKK 使いの私にとって skk.vim のおかげでさほど重要では無かったのだけれど、これを機にインライン入力対応版 gvim をビルドしてみることにした。

パッチ拝借元

必要なもの

  • gcc (Xcode をインストール)
  • wget (MacPorts の場合:sudo port install wget)
  • 7za (MacPorts の場合:sudo port install p7zip)
7za の実行に失敗する場合、以下を実行
% cd /opt/local/bin
% sudo rm 7za
% sudo ln -s /opt/local/lib/p7zip/7za

ビルドスクリプト

#!/bin/zsh

# http://mig-ration.blogspot.com/2007/04/mac-vim70-216.html

KAORIYA_REV=216

mkdir mac-vim70-$KAORIYA_REV
cd mac-vim70-$KAORIYA_REV

# Download vim7
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.0.tar.bz2
wget ftp://ftp.vim.org/pub/vim/extra/vim-7.0-extra.tar.gz
wget ftp://ftp.vim.org/pub/vim/extra/vim-7.0-lang.tar.gz

# Download vim patches
wget http://www.kaoriya.net/testdir/vim7-daily-w32j.exe
wget http://2xup.org/repos/vim/configure.diff
wget http://iplab.naist.jp/member/mio-su/dist/vim/inline0.2.diff

perl -i -pe 's/vim70-inline/./g' inline0.2.diff

# Download vim patches (official)
mkdir vim70-patches
cd vim70-patches
wget ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.{001..$KAORIYA_REV}

# Extract archives
cd ..
tar jxvf vim-7.0.tar.bz2
tar zxvf vim-7.0-extra.tar.gz
tar zxvf vim-7.0-lang.tar.gz
7za x vim7-daily-w32j.exe

# Apply patches
cd vim70
cat ../vim70-patches/7.0.* | patch -p0
cat ../vim7-daily-w32j/patches/* | patch -p0
cat ../configure.diff | patch -p0
cat ../inline0.2.diff | patch -p0

# Build and Install
./configure --with-features=big --enable-multibyte
make
sudo make install
sudo rm -rf /Applications/Vim.app/Contents/Resources/vim/runtime
sudo cp -R runtime /Applications/Vim.app/Contents/Resources/vim
ダウンロード:mac-vim70-216.sh

インストール方法

このスクリプトを実行すると /Applications/Vim.app が作成されます。

% chmod +x mac-vim70-216.sh
% ./mac-vim70-216.sh

途中パスワードの入力が求められる場合があります。(要管理者権限)

完成

関連URL

追記(2007.05.24)

こちらの方がお勧めです。
Macでいろいろ対応したVim7.1(gvim)のインストール