ubuntu下vim的安装与配置

由于ubuntu16.04已经可以用vim直接打开文件,所以大可不必使用gvim了,vim显得更加轻巧。

vim的安装:

sudo apt-get install vim

sudo apt-get install vim-gnome

vim的配置:

1.在/home下,Ctrl + H显示隐藏文件, 新建文件.vimrc,便可对vim进行配置.

set ai
set aw
set ar
set si
set sc
set sm
set nu
set cin
set hls

set go=0
set bs=2
set ls=2
set so=3
set mat=3
set ts=4
set sw=4 sta
set mouse=a
set shm=atI
set list lcs=tab:\ \ 

autocmd BufEnter * cd %:p:h 

syntax enable
filetype on
filetype plugin on

func! Run_cpp()
 exec "w!"
 exec "!clear && g++ %<.cpp -o %< -g && ./%<"
endfunction

map <F9> :call Run_cpp()<cr>

map <space>h <C-w>h
map <space>j <C-w>j
map <space>k <C-w>k
map <space>l <C-w>l

map <space>[ <C-w>-
map <space>] <C-w>+
map <space>, <C-w><
map <space>. <C-w>>

map <space>w :wall<cr>
map <space>q :wqall<cr>
map <space><space>h :vsp<cr>
map <space><space>k :sp<cr>


set rtp+=~/.vim/bundle/vundle/  
call vundle#rc()  

Plugin 'gmarik/vundle'
Plugin 'bling/vim-airline'

let g:airline_powerline_fonts = 1

 

2.vim的插件

暂时就只装了一个air-line

使用vundle管理。

 

3.vim是基于终端的,所以背景/字体/配色都可以在 终端-编辑-配置文件首选项 中修改。

我最终的配置效果如下。

 

posted @ 2016-05-28 22:06  jszyxw  阅读(13175)  评论(0编辑  收藏  举报