memo.xight.org

日々のメモ

カテゴリ : vim

1ページ目 / 全3ページ

MacVim-KaoriYa をソースからビルド

Summary

% brew tap splhack/homebrew-splhack
% brew install --HEAD cmigemo-mk
% brew install --HEAD ctags-objc-ja
% brew install gettext-mk
% brew unlink cmigemo ctags
% brew link cmigemo-mk ctags-abjc-ja
% brew install --HEAD macvim-kaoriya
==> Cloning https://github.com/splhack/macvim.git
Updating /Library/Caches/Homebrew/macvim-kaoriya--git
Error: /usr/local/Cellar/python3/3.3.2/bin/python3

/usr/local/Library/Taps/splhack-splhack/macvim-kaoriya.rb

% brew edit macvim-kaoriya

29行目あたり

"#{HOMEBREW_PREFIX}/Cellar/python3/3.3.2/bin/python3",
"#{HOMEBREW_PREFIX}/Cellar/ruby/2.0.0-p247/bin/ruby20",


バージョンが固定値なので、適宜修正。

% brew install macvim-kaoriya

Reference

Building - macvim-kaoriya - MacVim-KaoriYaのビルド方法 - MacVim KaoriYa - Google Project Hosting
https://code.google.com/p/macvim-kaoriya/wiki/Building

lightline - Yet another clone of powerline

Summary

vim-powerline は deprecated
powerline は 右端に隙間ができてしまう
vim-airline は軽量だが設計がイマイチ(?)
ということで開発されたのが lightline

簡単にカスタマイズできるし、 tmux-powerline との相性もバッチリ。
早速乗り換え。

tpope/vim-fugitive をインストールすれば、
git の ブランチ名を表示してくれる

lightline

Reference

itchyny/lightline.vim
https://github.com/itchyny/lightline.vim

tpope/vim-fugitive
https://github.com/tpope/vim-fugitive'

プログラムモグモグ - 2013-08-24 - lightline.vim作りました - プラグインの直交性について
http://d.hatena.ne.jp/itchyny/20130824/1377351527

neocomplecache から neocomplete へのマイグレーション

Summary

NeoBundleUpdate したら vim 起動時にメッセージが出るようになった。

neocomplete does not work this version of Vim.
It requires Vim 7.3.885 or above and "if_lua" enabled Vim.

homebrew で "if_lua" enabled Vim を インストール

% brew info vim
vim: stable 7.4.052, HEAD
http://www.vim.org/
/usr/local/Cellar/vim/7.4 (1558 files, 27M)
  Built from source
/usr/local/Cellar/vim/7.4.027 (1558 files, 27M) *
  Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/vim.rb
==> Dependencies
Optional: lua
==> Options
--disable-nls
            Build vim without National Language Support (translated messages, keymaps)
--override-system-vi
        Override system vi
--with-lua
        Build vim with lua support
--with-mzscheme
        Build vim with mzscheme support
--with-perl
        Build vim with perl support
--with-tcl
        Build vim with tcl support
--without-python
        Build vim without python support
--without-ruby
        Build vim without ruby support

% brew install --with-lua vim
Error: vim-7.4.027 already installed
To install this version, first `brew unlink vim'

% brew unlink vim
Unlinking /usr/local/Cellar/vim/7.4.027... 144 links removed

% brew install --with-lua vim

vimrc

neocompcache を neocomplete に置換
neocomplete migration guide を参考に

:%s/g:neocomplcache_/g:neocomplete#
:%s/neocomplcache#/neocomplete#

Reference

GitHub - neocomplete migration guide - Shougo/neocomplete.vim Wiki
https://github.com/Shougo/neocomplete.vim/wiki/neocomplete-migration-guide

solarlized の導入

Summary

solarlized を使って、tmux, vim, iTermのカラーリングを統一したい。

.vimrc

NeoBundle 'altercation/vim-colors-solarized'

set t_Co=256
syntax enable
colorscheme solarized
set background=dark

tmux

git clone git://github.com/altercation/solarized.git

.tmux.conf

source-file /path/to/repos/solarized/tmux/tmuxcolors-256.conf

iTerm

以下のファイルをインポート
/path/to/repos/solarized/iterm2-colors-solarized/Solarized Dark.itermcolors

[Preferences...] - [Profiles] - [Colors] - [Load Presets...] でカラースキームをインポートする。

dircolors

homebrew で dircolors と GNU lsをインストール

brew install coreutils
git clone git://github.com/seebi/dircolors-solarized

.zshrc

if [[ -x /usr/local/bin/gls ]]; then
	alias ls="gls --color=auto"
fi
if [[ -x /usr/local/bin/gdircolors ]]; then
	alias dircolors="gdircolors"
fi
if [[ -r /path/to/repos/dircolors-solarized/dircolors.256dark ]]; then
	eval `dircolors $HOME/repos/dircolors-solarized/dircolors.256dark`
fi

Reference

Solarized - Ethan Schoonover
http://ethanschoonover.com/solarized

GitHub - altercation/vim-colors-solarized
https://github.com/altercation/vim-colors-solarized

GitHub - seebi/dircolors-solarized
https://github.com/seebi/dircolors-solarized

powerline の導入

Summary

powerlineを使って、tmux, vim, iTermのステータスバーを統一したい。
iTermについては、文字化けを防ぐためにフォントにパッチを当てる必要がある。

準備

-- grep のインストール

brew tap homebrew/dupes
brew install homebrew/dupes/grep

powerline用フォントの作成

brew install fontforge
fontforge -script ~/.vim/bundle/powerline/font/fontpatcher.py SourceCodePro-Regular.otf

fontpatcher.py が作成したpowerline用フォントをインストール。

iTerm

[Preferences...] - [Profiles] - [Text] - [Change Font]で powerline用フォントを選択

.vimrc

NeoBundle 'alpaca-tc/alpaca_powertabline'
NeoBundle 'Lokaltog/powerline', { 'rtp' : 'powerline/bindings/vim'}

tmux

git clone https://github.com/erikw/tmux-powerline.git

.tmux.conf

set-option -g status on
set-option -g status-interval 2
set-option -g status-utf8 on
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set-option -g status-left "#(~/path/to/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/path/to/tmux-powerline/powerline.sh right)"

.tmux-powerlinerc

/path/to/repos/tmux-powerline/generate_rc.sh
/path/to/repos/tmux-powerline/segments/weather.sh: line 9: shell_is_bsd: command not found
Default configuration file generated to: $HOME/.tmux-powerlinerc.default
Copy/move it to "$HOME/.tmux-powerlinerc" and make your changes.

東京の天気予報を表示させる場合
Yahoo! Weather のURLを参照して天気予報を取得する
http://weather.yahoo.com/japan/tokyo-prefecture/tokyo-1118370/

export TMUX_POWERLINE_SEG_WEATHER_LOCATION="1118370"

Reference

GitHub - tmux-powerline
https://github.com/erikw/tmux-powerline.git

Qiita - Vim - powerlineをいつ使う? 今でしょ!
http://qiita.com/alpaca_taichou/items/ab70f914a6a577e25d70

VimでUTF-16を扱う

Summary

iTunes の Localizable.strings ファイルを変更する場合などに利用する。

:e ++enc=utf-16le

,eu16 で UTF-16LE で再読み込みする .vimrc

nmap ,eu16 :e ++enc=utf-16le<CR>

surround.vim - vim の text-object をより便利に使えるプラグイン

Demo




Reference

vim online - surround.vim - Delete/change/add parentheses/quotes/XML-tags/much more with ease
http://www.vim.org/scripts/script.php?script_id=1697

2nd life - 2006-12-25 - vim の text-object をより便利に使えるプラグイン - surround.vim
http://d.hatena.ne.jp/secondlife/20061225/1167032528

surround.vimでHTML編集を効率化 - Webtech Walker
http://webtech-walker.com/archive/2009/02/08031540.html

PuTTY + screen 上で vimのマウスを利用する方法

Summary

PuTTY + screenを利用中にvimのステータスバーを動かすことができる.
タブの選択も可能.
とても便利!

.vimrc

" マウスモード有効
set mouse=a

" screen対応
if &term == "screen"
    set ttymouse=xterm2
endif

Reference

おさかなラボ - 便利過ぎるvim + マウスをscreenで使う
http://kaede.to/~canada/doc/vimmouse-with-screen

おさかなラボ - vimのマウス機能が便利すぎる件
http://kaede.to/~canada/doc/vimiythyyuceoioei

via

cl.pocari.org - PuTTY + screen + Vim + マウスが便利すぎる件
http://cl.pocari.org/2007-03-14-3.html

Webページにソースコードを表示するには

方法

1. <textarea>
Ctrl+A で Copy & Paste が楽.

2. <pre> + CSS

3. <pre> + <code> + CSS

4. <textarea> + dp.SyntaxHighlighter[2006-06-12-7]

CSSの例

pre.code {
	font-family: monospace;
	white-space:pre;
	overflow:scroll;
}


vimの設定

.vimrc に記述
" html escape function
:function HtmlEscape()
silent s/&/\&/eg
silent s/ silent s/>/\>/eg
:endfunction


対象範囲を選択後,
:call HtmlEscape()


Reference

i d e a * i d e a - ブログにコードを貼り付ける方法で悩むの巻
http://www.ideaxidea.com/archives/2006/09/post_129.html

404 Blog Not Found:ソースを貼付ける50の方法
http://blog.livedoor.jp/dankogai/archives/50621177.html

hail2u.net - Weblog - pre要素へのスタイル指定
http://hail2u.net/blog/webdesign/styling-pre.html

2xup - 2006-09-07 - pre 要素のスタイル定義とマークアップ
http://2xup.org/log/2006/09/07-0056

hxxk.jp - 2006-09-06 - Re: i d e a * i d e a - ブログにコードを貼り付ける方法で悩むの巻
http://hxxk.jp/2006/09/06/2210

i d e a * i d e a - 2006-09-07 - ソースの貼り付け方法その後
http://www.ideaxidea.com/archives/2006/09/post_131.html

vim 6.3 - Source からの Install

解凍

$ tar -xjvf vim-6.3.tar.bz2
$ tar -xzvf vim-6.3-extra.tar.gz
$ tar -xzvf vim-6.3-lang.tar.gz

パッチをあてる

$ cat ../patches/6.3.* | patch -p0

configure , make

$ ./configure --enable-multibyte \
              --with-features=big \
              --disable-gui \
              --without-x
$ make
$ make test
# make install