ติดตั้ง Vim Powerline ใน OSX 10.9

Armno's avatar image
Published on December 12th, 2014
By Armno P.

Vim Powerline นั้นทำให้ status bar ของ Vim จากจืดๆ ดูดีขึ้น .. จริงๆ แล้วปรับแต่งได้อีกมากมาย ดูได้จาก document ได้เลยจ้า (ส่วนผมลงไว้เพื่อความบันเทิง)

ก่อน

หลัง

อันดับแรกเช็คเวอร์ชั่นของ Python ในเครื่องก่อน ซึ่งใน document ของ Powerline แนะนำให้ใช้เวอร์ชั่น 2.7 ครับ

$ python --version
# ของผมเป็น python 2.7.5

จากนั้นก็พบว่า ในเครื่องยังไม่มี pip ซึ่งจำเป็นสำหรับลง Powerline ก็ต้องลง pip ซะก่อน

$ sudo easy_install pip

แล้วก็ลง Powerline ผ่าน pip

$ pip install --user git+git://github.com/Lokaltog/powerline

เพื่อให้ Powerline ทำงาน ก็ต้องเพิ่ม path ของ Powerline ในไฟล์ ~/.vimrc

if has('statusline')
  " Always show status line
  set laststatus=2

  " Vim Powerline
  set rtp+=~/Library/Python/2.7/lib/python/site-packages/powerline/bindings/vim
endif

สุดท้ายเลือกใช้ font ที่ support Powerline (ซึ่งมักจะมีตัวอักษรแปลกๆ) ได้จาก Lokaltog/powerline-fonts

เป็นอันเสร็จพิธี