2013년 12월 20일 금요일

gVim 윈도우 7에서 _vimrc 편집

gVim7.4를 다운로드 받아서 설치를 하면, 기본적으로 시스템 전체에서 사용되는 _vimrc 파일이 "C:\Program Files (x86)\Vim"에 생성된다.
그런데 administrator 권한이 없으면 편집을 할 수가 없다.
권한이 있다고 하더라도 권장하지 않는다.
대신에 자신의 사용자 계정으로 _vimrc 파일을 복사해서 편집하면 된다.
예를 들어, "C:\Users\<사용자 이름>\_vimrc"
 1 set nocompatible
 2 source $VIMRUNTIME/vimrc_example.vim
 3 source $VIMRUNTIME/mswin.vim
 4 behave mswin
 5 
 6 set diffexpr=MyDiff()
 7 function MyDiff()
 8   let opt = '-a --binary '
 9   if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
10   if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
11   let arg1 = v:fname_in
12   if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
13   let arg2 = v:fname_new
14   if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
15   let arg3 = v:fname_out
16   if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
17   let eq = ''
18   if $VIMRUNTIME =~ ' '
19     if &sh =~ '\<cmd'
20       let cmd = '""' . $VIMRUNTIME . '\diff"'
21       let eq = '"'
22     else
23       let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
24     endif
25   else
26     let cmd = $VIMRUNTIME . '\diff'
27   endif
28   silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
29 endfunction
30 
31 set nu
32 set nobackup
33 set cindent
34 set shiftwidth=4
35 set tabstop=4
36 set hlsearch
37 set ignorecase
38 filetype on
39 colorscheme evening

댓글 없음:

댓글 쓰기