ubuntu12.04安装和配置gvim7.3

1,下载gvim

http://www.vim.org/download.php

2,将下载的文件解压到/tmp目录下面

cd vim73
cd src
./configure

如果安装中遇到下面类似的问题

You need to install a terminal library; for example ncurses.
      Or specify the name of the library with –with-tlib.

可以通过如下的方式解决

sudo apt-get install libncurses5-dev

然后进行编译安装就可以了

sudo make 
sudo make install

安装过程结束

然后在终端打开试试,是不是打不开

哦,忘记了一个安装命令

sudo apt-get install vim-gnome

然后在试试,成功了!!!

3,配置

下面一些相关的配置需要文件,请到http://www.vim.org/scripts/下载,要学会搜索啊,搜索自己想要的

set nocp    "设置兼容
set expandtab   "设置tab
set shiftwidth=4    "设置tab的间隔
set tabstop=4   "四个空格代表一个tab
set sts=4
set showmatch   "在输入括号时光标会短暂地跳到与之相匹配的括号处
set autoindent  "设置自动缩进
set smartindent "设置智能缩进
set wrap    "设置自动换行
set tw=500
set lbr
set number  "设置是否显示行
set guifont=Monospace\ 11  "设置字体大小 
set encoding=utf-8  "设置编码为中文
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,GB18030,cp936,big5,euc-jp,euc-kr,latin1
set helplang=cn "帮助中文支持

"###############################自动补全配置##############################
autocmd FileType python set omnifunc=pythoncomplete#Complete 
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS 
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags 
autocmd FileType css set omnifunc=csscomplete#CompleteCSS 
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags 
autocmd FileType php set omnifunc=phpcomplete#CompletePHP 
autocmd FileType c set omnifunc=ccomplete#Complete 



"############################键盘映射设置区域###############################
map <F10><F10> :TlistToggle<CR> "TlistToggle的键盘映射
map <F9><F9> :NERDTreeToggle<CR>    "NERDTreeToggle的键盘映射


"#########################对应使用函数的配置#################################
set guitablabel=%{ShortTabLabel()}
function ShortTabLabel ()
  let bufnrlist = tabpagebuflist (v:lnum)
  let label = bufname (bufnrlist[tabpagewinnr (v:lnum) -1])
  let filename = fnamemodify (label, ':t')
  return filename
endfunction

set tabline=%!MyTabLine()
function MyTabLine()
  let s = ''
  for i in range(tabpagenr('$'))
    " 选择高亮
    if i + 1 == tabpagenr()
      let s .= '%#TabLineSel#'
    else
      let s .= '%#TabLine#'
    endif
    " 设置标签页号 (用于鼠标点击)
    let s .= '%' . (i + 1) . 'T'
    " MyTabLabel() 提供完整路径标签 MyShortTabLabel 提供文件名标签
    let s .= ' %{MyShortTabLabel(' . (i + 1) . ')} '
  endfor
  " 最后一个标签页之后用 TabLineFill 填充并复位标签页号
  let s .= '%#TabLineFill#%T'
  " 右对齐用于关闭当前标签页的标签
  if tabpagenr('$') > 1
    let s .= '%=%#TabLine#%999Xclose'
  endif
  return s
endfunction
" 文件名标签
function MyShortTabLabel(n)
  let buflist = tabpagebuflist(a:n)
  let label = bufname (buflist[tabpagewinnr (a:n) -1])
  let filename = fnamemodify (label, ':t')
  return filename
endfunction
"完整路径标签
function MyTabLabel(n)
  let buflist = tabpagebuflist(a:n)
  let winnr = tabpagewinnr(a:n)
  return bufname(buflist[winnr - 1])
endfunction
" vim 标签样式
"  TabLineFill  tab pages line, where there are no labels
hi TabLineFill term=none
hi TabLineFill ctermfg=DarkGrey
hi TabLineFill guifg=#777777
"  TabLineSel   tab pages line, active tab page label
hi TabLineSel term=inverse
hi TabLineSel cterm=none ctermfg=yellow ctermbg=Black
hi TabLineSel gui=none guifg=yellow guibg=Black
 
" Develop editing options
au FileType vim setl expandtab
au FileType vim setl shiftwidth=2
au FileType vim setl tabstop=2

" 显示状态栏(默认值为 1,无法显示状态栏)
set laststatus=2
" Format the statusline
set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}E5%h\ \ \ Line:\ %l/%L:%c
 
function! CurDir()
    let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
    return curdir
endfunction

你可能感兴趣的:(ubuntu12.04安装和配置gvim7.3)