gVim在Windows服务器中的安装部署
在运维过程中,经常会对各种配置文件进行编辑修改,Linux下已经熟练运用Vim来修改各种配置了,有时候再Windows下也会修改一些文件,更主要的是查看一些配置文件或者日志,特别是日志文件很大的时候,用记事本或其他编辑器查看的时候效率很低,故在Windows服务器中安装gVim来满足如上需求,下面将我的部署过程简略加以说明:
1、登陆http://www.vim.org/download.php#pc,下载windows版vim (Gvim) ftp://ftp.vim.org/pub/vim/pc/gvim73_46.exe
2、安装 gvim,双击gvim73_46.exe
3、单击是,弹出Vim 7.3 的协议说明,单击”I Agree”:
4、弹出安装选项对话框,选择”full”,单击 “next”
5、安装目录选择默认 即可,我的操作系统为Windows Server 2008 R2 SP1,所以会提示如下安装目录:C:\Program Files (x86)\Vim,单击 install
6、单击close,再单击 否 完成安装,桌面上出现三个图标,gVim 7.3,gVim Easy 7.3,gVim Read only 7.3
7、配置相关的选项,Windows中vim的配置文件_vimrc
本例中:C:\Program Files (x86)\Vim\_vimrc
在改文件中追加如下选项:
set incsearch
set nobackup
set nowritebackup
colo peachpuff
set fileencodings=utf-8,gb18030,utf-16,big5,ucs-bom,default,latin1
上述选项的意义不再加以说明,请读者自己加以搜索理解,亦可以根据自身需求或者喜好加以修改!
附_vimrc的全部内容:
set nocompatible
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
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
set incsearch
set nobackup
set nowritebackup
colo peachpuff
set fileencodings=utf-8,gb18030,utf-16,big5,ucs-bom,default,latin1
1、登陆http://www.vim.org/download.php#pc,下载windows版vim (Gvim) ftp://ftp.vim.org/pub/vim/pc/gvim73_46.exe
2、安装 gvim,双击gvim73_46.exe
3、单击是,弹出Vim 7.3 的协议说明,单击”I Agree”:
4、弹出安装选项对话框,选择”full”,单击 “next”
5、安装目录选择默认 即可,我的操作系统为Windows Server 2008 R2 SP1,所以会提示如下安装目录:C:\Program Files (x86)\Vim,单击 install
6、单击close,再单击 否 完成安装,桌面上出现三个图标,gVim 7.3,gVim Easy 7.3,gVim Read only 7.3
7、配置相关的选项,Windows中vim的配置文件_vimrc
本例中:C:\Program Files (x86)\Vim\_vimrc
在改文件中追加如下选项:
set incsearch
set nobackup
set nowritebackup
colo peachpuff
set fileencodings=utf-8,gb18030,utf-16,big5,ucs-bom,default,latin1
上述选项的意义不再加以说明,请读者自己加以搜索理解,亦可以根据自身需求或者喜好加以修改!
附_vimrc的全部内容:
set nocompatible
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
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
set incsearch
set nobackup
set nowritebackup
colo peachpuff
set fileencodings=utf-8,gb18030,utf-16,big5,ucs-bom,default,latin1
相关推荐
yhuihon 2020-05-04
lerdor 2020-10-14
linzb 2020-09-22
HeronLinuxampARM 2020-09-14
CoderMannul 2020-09-07
lerdor 2020-08-31
ZZBAIFFA 2020-08-31
yonggeno 2020-08-18
yhuihon 2020-08-17
涅磐 2020-08-11
yhuihon 2020-08-09
zhangxl0 2020-07-28
yhuihon 2020-07-26
想个标题偏头痛 2020-07-19
老甘的可读区 2020-07-18
linzb 2020-07-18
xlb 2020-07-12
老甘的可读区 2020-07-09