1 安装vim
sudo apt-get install vim
2 创建属于自己的vim配置文件.vimrc
vim ~/.vimrc
3 为你的命令行,tmux和vim安装powerline插件
3.1 安装python3-pip
sudo apt-get install python3-pip
3.2 安装git
sudo apt-get install git
3.3 安装powerline
pip3 install git+git://github.com/Lokaltog/powerline
3.4 安装powerline在ubuntu中的字体
#在下载字体
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
#下载配置文件
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
#将字体移动到你的字体目录下,可能是/usr/share/fonts/ 或者 /usr/local/share/fonts
mv PowerlineSymbols.otf /usr/share/fonts/
#更新系统的字体
fc-cache -vf /usr/share/fonts/
#讲配置文件移动到字体配置文件下
mv 10-powerline-symbols.conf /etc/fonts/conf.d/
3.5 查看powerline安装的位置
$ pip3 show powerline-status
>>
Name: powerline-status
Version: 2.7.dev9999-git.b-393ff7119fec64e201abfd2b251b402c7a533b09-
Summary: The ultimate statusline/prompt utility.
Home-page: https://github.com/powerline/powerline
Author: Kim Silkebaekken
Author-email: [email protected]
License: MIT
Location: /home/simileciwh/.local/lib/python3.6/site-packages
Requires:
根据location可知安装位置为:/home/simileciwh/.local/lib/python3.6/site-packages(记住这个,后面配置很重要)
3.6 为bash配置powerline
vim ~/.bashrc
配置如下:
# Powerline setting
5 export TERM='xterm-256color'
6 powerline-daemon -q
7 POWERLINE_BASH_CONTINUATION=1
8 POWERLINE_BASH_SELECT=1
#第九行为自己的安装powerline位置/powerline/bindings/bas h/powerline.sh
#注意开头为--->>.空格/home/simileciwh/.....
9 . /home/simileciwh/.local/lib/python3.6/site-packages/powerline/bindings/bas h/powerline.sh
3.7 为tmux配置powerline
vim ~/.tmux.conf
#source 这一行需要改动,和之前3.6节一样的方法
source /home/simileciwh/.local/lib/python3.6/site-packages/powerline/bindings/tmux/powerline.conf
set-option -g default-terminal screen-256color
3.8 为vim配置powerline
vim ~/.vimrc
"POWERLINE SETTING
5 set rtp+=/home/simileciwh/.local/lib/python3.6/site-packages/powerline/bindings/vim
6 set laststatus=2
7 set t_Co=256
8 let g:Powerline_symbols= "fancy"
3.9 最终效果如下图所示:
图1 terminal的变化
图2 vim的变化
图3 运行tmux
图4 tmux bash的变化
3.10 关于我的tmux,vim,bash的powerline配置文件在这里可以下载参考:
link: https://download.csdn.net/download/simileciwh/10752995
4 vim的插件
给vim安装插件有很多方式,我采用的是比较简单容易的Vundle
下载安装:https://github.com/VundleVim/Vundle.vim
set nocompatible " be iMproved, required
2 filetype off " required
3
10
11 """"""""""""""""""""""""""""""""""""""
12 " set the runtime path to include Vundle and initialize
13 set rtp+=~/.vim/bundle/Vundle.vim
14
15 call vundle#begin()
16
17
18 "Plugins
19 Plugin 'VundleVim/Vundle.vim'
20 Plugin 'scrooloose/nerdtree'
21 Plugin 'vim-airline/vim-airline-themes'
22
23 "Plugin 'vim-sensible/sensible.vim'
24 "Plugin 'nerdtree/nerdtree.vim'
25
26
27 call vundle#end() " required
28
29 filetype plugin indent on " required
30 "
31 " Brief help
32 " :PluginList - lists configured plugins
33 " :PluginInstall - installs plugins; append `!` to update or just
34 ":PluginUpdate
35 " :PluginSearch foo - searches for foo; append `!` to refresh local cache
36 " :PluginClean - confirms removal of unused plugins; append `!` to
37 "auto-approve removal
这是vundle的大体框架,只需要知道你要安装的插件在github上的名字和仓库的名字即可,只需要在
call vundle#begin()
call vundle#end() 之间的Plugin '仓库名/插件名'即可
保存退出后,
在vim commond-line中输入:PluginInstall即可,完成下载安装。
非常容易使用。
5