GVIM安装手记

GVIM安装手记

1. 安装GIT及GVIM

Downloa Git URL : https://gitforwindows.org/

Downloa GVim URL : https://www.vim.org/download.php

2. 安装cURL

cURL是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所以是综合传输工具,但按传统,习惯称cURL为下载工具。cURL还包含了用于程序开发的libcurl。
cURL支持的通信协议有FTP、FTPS、HTTP、HTTPS、TFTP、SFTP、Gopher、SCP、Telnet、DICT、FILE、LDAP、LDAPS、IMAP、POP3、SMTP和RTSP。
例如:获取网页 : curl http://www.baidu.com

Download URL : https://curl.haxx.se/download.html#Win64

解压ZIP至C:\Program Files,添加PATH环境变量

PATH = C:\Program Files\Git\Cmd

VIM = D:\Vim

Curl = C:\Program Files\Curl

3.安装 Vundle 管理插件

进入D:\Vim 执行 git bash(管理员模式)

git clone https://github.com/VundleVim/Vundle.vim.git vimfiles/bundle/Vundle.vim

编辑 _vimrc 添加vundle配置及NERDTree插件

"----------------vundle start------------------
set rtp+=$VIM/vimfiles/bundle/Vundle.vim/
call vundle#begin('$VIM/vimfiles/bundle/')
" All of your Plugins must be added before the following line
Plugin 'VundleVim/Vundle.vim'
Plugin 'git://github.com/scrooloose/nerdtree.git'
call vundle#end()            " required
filetype plugin indent on    " required
"----------------vundle end--------------------


"autocmd vimenter * NERDTree
map <F2> :NERDTreeToggle<CR>
"nerdtree end

进入GVIM 执行:PluginInstall

如果报错 按 l 查看错误日志,如提示权限错误,请使用管理员模式启动 gVim

4.NERDTree配置及快捷键

ctrl+w:再加上vim的上下左右四个键即可在上下左右四个窗口切换。
o:在新建窗口中打开选定的文件或展开文件夹
s:在已有窗口中打开选定的文件或展开文件夹
m:显示文件系统菜单 ,然后根据提示进行文件的操作如新建,重命名等,比如a,添加目录或文件,d删除目录或文件
R:刷新目录
u:当前目录的父目录作为跟目录
C:当前目录作为跟目录

VIMRC配置文件备份

"----------解决中文乱码-----------------------"
set encoding=utf-8 
set termencoding=utf-8 
set fileencoding=utf-8 
set fileencodings=ucs-bom,utf-8,chinese,cp936 
"---------------------------------------------"
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

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

"----------------vundle start------------------
set rtp+=$VIM/vimfiles/bundle/Vundle.vim/
call vundle#begin('$VIM/vimfiles/bundle/')
" All of your Plugins must be added before the following line
Plugin 'VundleVim/Vundle.vim'
Plugin 'git://github.com/scrooloose/nerdtree.git'
call vundle#end()            " required
filetype plugin indent on    " required
"----------------vundle end--------------------

"----------------NERDTree start ---------------
"文件树设置 
autocmd vimenter * NERDTree
map <F2> :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
""修改树的显示图标
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
let NERDTreeAutoCenter=1
""显示行号
let NERDTreeShowLineNumbers=1
""是否显示隐藏文件
let NERDTreeShowHidden=1
""设置宽度
let NERDTreeWinSize=40
""在终端启动vim时,共享NERDTree
let g:nerdtree_tabs_open_on_console_startup=1
""忽略一下文件的显示
let NERDTreeIgnore=['\.pyc','\~$','\.swp']

"----------------NERDTree end -----------------

"禁止生成un备份文件
"------------------
set noundofile
set nobackup
set noswapfile
"------------------

"-------设置字体
set guifont=Hack:h13:cANSI:qDRAFT

"-------窗口默认最大化
autocmd GUIEnter * simalt ~x
"-------设置不自动折行
set nowrap 
"-------vim提示信息乱码的解决 
language messages zh_CN.utf-8

2019-04-30 待续

猜你喜欢

转载自www.cnblogs.com/maozhe/p/10798436.html
今日推荐