为Bash和VIM配置一个提高效率的状态提示栏

前言:

看到别人使用powelinebashvim做的状态栏特稀罕,于是花了点时间也干了。

 ChenShiLongdeMac-mini:~ MrChen$ python -V
 ChenShiLongdeMac-mini:~ MrChen$ brew install python  
 ChenShiLongdeMac-mini:~ MrChen$ pip install --upgrade pip
 ChenShiLongdeMac-mini:~ MrChen$ pip show powerline-status  
 ChenShiLongdeMac-mini:~ MrChen$ pip install powerline-status
 ChenShiLongdeMac-mini:~ MrChen$ python --version|grep +python  

ChenShiLongdeMac-mini:Library MrChen$ pip show powerline-status
---
Metadata-Version: 1.1
Name: powerline-status
Version: 2.1
Summary: The ultimate statusline/prompt utility.
Home-page: https://github.com/powerline/powerline
Author: Kim Silkebaekken
Author-email: kim.silkebaekken+vim@gmail.com
License: MIT
Location: /usr/local/lib/python2.7/site-packages
Requires:

配置Bash使用powerline

在Bash的配置文件中增加一行调用安装路径下的bingings/bash/powerline.sh就可以了。Bash的配置文件如:/etc/bashrc,~/.bashrc,~/.bash_profile
我是直接在/etc/bashrc增加了一行. /usr/local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh就可以了。
下面的是用命令行加的,但我不会。

ChenShiLongdeMac-mini:~ MrChen$  echo << EOF >> ~/.bash_profile
ChenShiLongdeMac-mini:~ MrChen$  . /usr/local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh
ChenShiLongdeMac-mini:~ MrChen$  EOF

Teriminal字体配置

git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh

装完以后就可以选择字体了,叫做xxx for powerline

brew install vim –with-python –with-ruby –with-perl

配置vim,首先创建用户版的vimrc(mac默认是没有的),你可以在用户主目录下自己创建一个空的用户版vimrc文件:

sudo sh
mkdir ~/.vimrc

也可以将全局版vimrc文件复制到用户主目录下做为用户版vimrc:

sudo cp  /usr/share/vim/vimrc  ~/.vimrc

这里说明一下,~/就是用户主目录,相当于/Users/用户名/
然后将下面的拷贝进去就行:

    set rtp+=/usr/local/lib/python2.7/site-packages/powerline/bindings/vim

" These lines setup the environment to show graphics and colors correctly.
set nocompatible
set t_Co=256

let g:minBufExplForceSyntaxEnable = 1
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup

if ! has('gui_running')
    set ttimeoutlen=10
    augroup FastEscape
          autocmd!
          au InsertEnter * set timeoutlen=0
          au InsertLeave * set timeoutlen=1000
     augroup END
 endif
 set laststatus=2 " Always display the statusline in all windows
 set guifont=Inconsolata\ for\ Powerline:h14
 set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)"
Zerlz wechat
扫码关注一个很懒的程序员!
Winter is coming, give me a penny!