LoginSignup
15

More than 5 years have passed since last update.

vim-powerline (lightline.vim)

Last updated at Posted at 2013-12-03

はじめに

この記事は、みんなで作ろう最強の設定ファイル Advent Calendar 2013という企画の一部です。

$ mkdir -p ~/dotfiles/.zsh/

$ cd !$

$ git clone https://github.com/syui/dotfiles.git

解説

vimというエディタで使えるpowerlineがあります。lightline.vimといいます。

まずは、ツールをダウンロードしていきましょう。

~/.vimrc
NeoBundle 'itchyny/lightline.vim'

ちなみに、NeoBundleのプラグインをコマンドラインからインストールできるようにするには、以下の様な感じのコマンドを使います。

$ . ~/.vim/bundle/neobundle.vim/bin/neoinstall

または、

$ vim +NeoBundleInstall +q

ちなみに、以下の様なシェルスクリプトを使って、インストールするものを引用したりも出来ます。

~/dotfiles/bin/neobundle-install
#!/bin/bash
vimrc=$HOME/dotfiles/.vimrc.bundle
fpion=`grep -n "filetype plugin indent on" ${vimrc} | sed -e 's/[^0-9]//g'`

sed -i -e "${fpion}d" ${vimrc} && echo -e "NeoBundle '$1'\nfiletype plugin indent on" >> ${vimrc} && vim +NeoBundleInstall +qall
$ chmod +x ~/dotfiles/neobundle-install

$ . !$ itchyny/lightline.vim

次に、設定していきます。MacVim に lightline.vim をインストールの記事が参考になります。

~/.vimrc
" lightline.vim
let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'component': {
      \   'readonly': '%{&readonly?"\u2b64":""}',
      \ },
      \ 'separator': { 'left': "\u2b80", 'right': "\u2b82" },
      \ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" },
      \ }

" カラー設定
set t_Co=256

こちらの設定は、iTerm2Preferences > Profiles > TerminalReport Terminal Typexterm-256color に設定すれば不要になります。

~/.zshrc
" カラー設定
export TERM=xterm-256color

また、フォントの三角部分が上手く表示されないようなら、パッチを当てましょう。

# リポジトリの clone
$ git clone https://github.com/Lokaltog/vim-powerline.git 
$ cd vim-powerline/fontpatcher

# fontpacher の適用
$ fontforge -script ./fontpatcher <フォントのパス>hoge.ttf
$ fontforge -script ./fontpatcher <フォントのパス>hoge.ttf

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
15