首页 > 技术文章 > vim的安装与配置

tutorial 2018-04-17 15:10 原文

1.安装字体

https://pan.baidu.com/s/1v4QqGnZX8G32dS9HsIvbXA

下载解压后,点击安装字体,程序员用等宽字体。

2.git安装
https://github-production-release-asset-2e65be.s3.amazonaws.com/23216272/d3b74700-1641-11e8-90a8-75ae58b88669?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180417%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180417T021201Z&X-Amz-Expires=300&X-Amz-Signature=c220d4a339e2e0fd3eb7c802ff8ab2a8c33f54c4402e406cf7b90afc2361d5f1&X-Amz-SignedHeaders=host&actor_id=512610&response-content-disposition=attachment%3B%20filename%3DGit-2.16.2-32-bit.exe&response-content-type=application%2Foctet-stream
下载后,安装。
 3.vim安装

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

下载vim 后,安装。

4.插件管理器

到 pathogen 的下载网页:http://www.vim.org/scripts/script.php?script_id=2332 ,下载pathogen.zip,下载后解压,提取出压缩包中的 pathogen.vim ,放到目录 \Vim\vim80\autoload 下面。 

用任意一种文本编辑器打开 \Vim\_vimrc 文件,在开头添加以下一行内容: 
execute pathogen#infect() 
保存 _vimrc 文件并退出编辑。
用 Git 下载并安装其他 vim 插件。
在目录 Vim\vimfiles 下面创建一个名为 bundle 的子目录。
到网站:http://vim-scripts.org/vim/scripts.html 上去找要下载的插件,比如要下载名为 EditPlus 的配色方案,在链接上单击鼠标右键,选择“复制快捷方式”,如下图所示:

cd vim\vimfiles\bundle
git clone 目标插件的网址。

5._vimrc for window

source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set nocompatible
set nobackup
set noswapfile   
set noundofile

set encoding=utf-8
set fileencodings=utf-8,ucs-bom,cp936,big5
set fileencoding=utf-8

source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim


set tabstop=4
set sts=4
set expandtab
set softtabstop=4
set shiftwidth=4
set number
set diffexpr=MyDiff()

function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction

set guifont=Bitstream_Vera_Sans_Mono:h14
map  <F12> :exe '!"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" %:p' <CR>
map  <F11> :exe  '!"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" %:p' <CR>

.vimrc  for linux  

set nobackup
set nowritebackup
set noundofile

set tabstop=4
set sts=4
set expandtab
set softtabstop=4
set shiftwidth=4

set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1

set number

set guifont=Bitstream\ Vera\ Sans\ Mono\ 14
nnoremap <F12> :!/opt/google/chrome/chrome '%:p'<CR>
execute pathogen#infect()
execute pathogen#helptags()

 

推荐阅读