Skip to content

Instantly share code, notes, and snippets.

@KentaYamada
Created April 16, 2016 14:10
Show Gist options
  • Save KentaYamada/6fbdb4fa6f840a82849732c3081e8390 to your computer and use it in GitHub Desktop.
Save KentaYamada/6fbdb4fa6f840a82849732c3081e8390 to your computer and use it in GitHub Desktop.
Vimのステータスバーにファイル情報を表示する
" Vimの改行コード表示がちと変わっているので、
" 一般的な改行コードに変換してステータスバーに表示するようにカスタマイズ
" 改行コード対応表
" CRLF: dos
" CR: unix
" LF: mac
set statusline = 2 "ステータスバーの表示行数を設定
let dic_line = { 'dos': 'CRLF', 'unix': 'CR', 'mac': 'LF'}
let f = &fileformat " 改行コード取得
let s = ''
if has_key(dic_line, f)
let s = dic_line[f]
else
let s = 'unkwown'
endif
set statusline=%t\ %m%r%h%w[%Y][%{&fenc}][%{s}]%=%c,%l%11p%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment