2009년 02월 08일
Vim 기본 세팅 완료. vimrc 공유합니다. 이것말고 최신버젼을 받으세요. 꼭
다음버젼에 추가된 사항 : SaveAsNewName 함수가 덮어씌우기 확인질문하고, Vim내에 같은파일이 로드되어있으면 경고질문···
자세한 사항은 주석을 참조하세요. 주석 열심히 첨가했습니다.
For the Vimer!
Be happy.
p.s. MiniBufExpl.vim 만드신분이 saveas명령이 떨어졌을때의 처리를 안 해놓으셔서 saveas명령후 :UMiniBufExplorer 명령추천. 근데 제작자가 답변이 없네. 하긴 2004년 11월중순에 나온건데··· 손때셨나?
_vimrc <- Click this to download it
" ※Beta version※ 0.9.02.1
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This is spawned by dewr <wind8702@gmail.com>
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Features
" Move the cursor to the window proper to discard or save. you can designate buffers you dont want to close or to save
" Hotkeys work on Insert mode and Command-line
" 특징
" 커서를 버리거나 저장하기에 적당한 창으로 옯깁니다. 당신은 어떤 버퍼가 닫히거나 저장되지 않을지 지정할 수 있습니다.
" Insert mode나 Command-line 에서도 단축키가 작동합니다.
" ※this script requires browse feature and dialog_gui-or-dialog_con feature.
" --if your Vim doesn't support browse feature, when it browses fora file to edit it will run "netrw" browser instead of GUI. I recommendyou to edit "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for otherkey. <F1> will be used for other function.
" --however, no support for writing without browse feature. (save as new name)
" ※이 스크립트는 browse feature와 dialog_gui-또는-diaolog_con 을 요구합니다.
" --만약 당신의 Vim 이 browse feature를 지원하지 않는다면 파일열기를 위한 브라우징은"netrw"를 통해서 이루어질 것입니다. "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" 이 두 파일안에서 <F1> 을 다른 키로변경하시기를 바랍니다. <F1> 은 다른 기능을 위해 사용됩니다.
" --하지만 browse feature없이 파일쓰기에 대한 지원은 없습니다. (다른이름으로 저장)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" options for functions made by dewr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Is the indicator '/'?
if ( has("win32") || has("os2") ) "works on win-64 also
let g:bDirectoryIndicator = '\\'
let g:bDirectorySlasher = '\'
else
let g:bDirectoryIndicator = '\/'
let g:bDirectorySlasher = '/'
endif
" the two value below is referenced even when Vim chooses a window to save(write), not only when Vim chooses a window to discard
" 아래의 두 변수는 닫을때 만 참조하는 것이 아니라, 저장할 때도 참조됩니다.
let g:ppbNeverClose = [ "-MiniBufExplorer-", "__Tag_List__" ] "the names of buffers you dont want to close. 당신이 닫고 싶지 않은 버퍼들의 이름
let g:ppbDontWannaClose = [ "nofile", "help" ] "Buffer type, leftmostone is the buftype you dont want to close most. 가장 왼쪽에 있는 type이 당신이 가장닫지 않기를 원하는 buftype입니다.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" plugins installed = {ctags, taglist, minibufexplorer, }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" taglist
let Tlist_Use_SingleClick = 1 "prefer to SingleClick
" minibufexplorer
let g:miniBufExplorerMoreThanOne = 0 "show MBE even if there is only a buffer in list.
let g:miniBufExplUseSingleClick = 1 "prefer to SingleClick
" ctags
let g:ctags_statusline=1 " To show tag name in status line.
let generate_tags=1 " To start automatically when a supported file is opened.
let g:ctags_args='-I __declspec+'
" (or whatever other additional arguments you want to pass to ctags)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" jobs in MS Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ftype txtfile="c:\documents and settings\administrator\desktop\d e w r\application\x86-64\vim72\gvim.exe" --remote-silent "%1"
" ftype inifile="c:\documents and settings\administrator\desktop\d e w r\application\x86-64\vim72\gvim.exe" --remote-silent "%1"
"
" ftype code="c:\documents and settings\administrator\desktop\d e w r\application\x86-64\vim72\gvim.exe" --remote-silent "%1"
" assoc .c=code
" assoc .h=code
" assoc .cpp=code
" assoc .vim=inifile
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" out of Vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" "$VIM/vimfiles/plugins/taglist.vim" 의 도움말 단축키가 <F1>인데 ?로 고치는걸 추천합니다. <F1>은 다른 기능을 위해 사용됩니다.
" in "$VIM/vimfiles/plugins/taglist.vim" change <F1> for ?. <F1> will be used for other function.
"
" $vim/vim72/syntax/c.vim 듀르가 애용하는 typedef-keywords···. just for me!
" " my expressions
" syn keyword ctype b_yte w_ord dw_ord qw_ord dwf_loat qwf_loat
" syn keyword ctype ub_yte uw_ord udw_ord uqw_ord udwf_loat uqwf_loat
"
" minibufexpl.vim -> 1079th line has to be fixed like below to show no-name buffers in MBE
" if(strlen(l:bufname)) --> if (1)
" minibufexpl.vim -> 1079번째 줄은 위와 같이 고쳐져야합니다. MBE에 이름없음-버퍼들도 표시하는게 좋기 때문입니다.
" if(strlen(l:bufname)) --> if (1)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" default contents of _vimrc in "gvim for windows on x86-64"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
if ( has("win32") ) "works on win-64 also
source $VIMRUNTIME/mswin.vim
behave mswin
endif
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 =~ g:bDirectorySlasher.'<cmd'
let cmd = '""' . $VIMRUNTIME . g:bDirectorySlasher.'diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . g:bDirectorySlasher.'diff"'
endif
else
let cmd = $VIMRUNTIME . g:bDirectorySlasher.'diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" functions made by dewr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" lTheList 에 pIt이 들어있나 확인하고 없으면 0 있으면 몇번째 원소인지를 리턴합니다.
" return 0 if pIt is not in lTheList, else it returns how many elements before pIt in lTheList.
function IsItInTheList(pIt, lTheList)
let l:dwLength = len(a:lTheList)
let l:dwCounter = 0
while (l:dwLength > l:dwCounter)
if ( a:lTheList[l:dwCounter] == a:pIt )
return l:dwCounter + 1
else
let l:dwCounter += 1
endif
endwhile
return 0
endfunction
" split fname into filename and directory
" 파일명과 디렉토리(위치)로 분리
function SplitFname(pbFname)
let l:pbDir = matchstr(a:pbFname, '.*'.g:bDirectoryIndicator)
let l:pbFile = substitute(a:pbFname, '.*'.g:bDirectoryIndicator, "", "")
let l:ppbReturnv = [ l:pbDir , l:pbFile ]
return l:ppbReturnv
endfunction
" deletes a buffer in current focused window and load another buffer in buffer list or an empty noname-buffer
" 현재창에 떠있는 버퍼를 지우고 버퍼리스트에 있는 다른 버퍼를 부르거나 리스트에 버퍼가 더 없을때는 비어있는 이름없음-버퍼를 띄워놓습니다.
function RunAndGun()
:setlocal bufhidden=hide
let l:dwBufFocused = winbufnr(0)
let l:dwBuffer = bufnr("$")
let l:dwCounter = -1
while ( l:dwBuffer > 0 )
if ( bufexists(l:dwBuffer) && buflisted(l:dwBuffer) && l:dwBuffer != l:dwBufFocused )
let l:dwCounter = l:dwBuffer
break
endif
let l:dwBuffer -= 1
endwhile
if ( l:dwCounter == -1 )
enew!
:setlocal bufhidden=hide
:setlocal buflisted
else
execute "buffer! ".l:dwCounter
endif
execute "bwipeout! ".l:dwBufFocused
endfunction
" save and quit or just quit
function QuitBuffer()
let l:dwBufFocused = winbufnr(0)
if ( !getbufvar(l:dwBufFocused, "&modified") )
call RunAndGun()
return
endif
let l:choice = confirm("save changes of ".@%, "&yes, save\n&no, do not save\n&cancel(esc key)", 2)
if l:choice == 1
if ( @% == "" )
let l:choice = browse(1, "save as···", 0, "")
if ( l:choice == "" )
echo "canceled."
return 7
else
execute "saveas! ".l:choice
endif
else
w
endif
elseif l:choice == 2
echo "didn't save it."
else
echo "canceled."
return 7
endif
call RunAndGun()
return 0
endfunction
" dribble cursor to the window is proper to bother. It references g:ppbNeverClose and g:ppbDontWannaClose.
" 커서를 괴롭히기 좋은 윈도우로 옯깁니다. g:ppbNeverClose 와 g:ppbDontWannaClose 를 참조합니다.
function KickCursor()
let l:pdwMax = [0,0]
let l:dwBuf = 1
let l:dwCounter = 0
let l:dwFirst = winbufnr(0)
let l:dwNow = l:dwFirst "ready to start of the loop
while ( !(l:dwFirst == l:dwNow && l:dwCounter != 0) )
if( buflisted(l:dwNow) )
return
elseif ( !IsItInTheList(bufname(l:dwNow), g:ppbNeverClose) )
let l:dwBuf = IsItInTheList(getbufvar(l:dwNow, "&buftype"), g:ppbDontWannaClose)
if ( !l:dwBuf )
let l:dwBuf = 9999 -l:dwCounter
endif
if (l:dwBuf > l:pdwMax[0])
let l:pdwMax[0] = l:dwBuf
let l:pdwMax[1] = l:dwNow
endif
endif
wincmd w
let l:dwCounter += 1
let l:dwNow = winbufnr(0)
endwhile "end of the loop
while ( l:dwCounter < 87 )
if ( winbufnr(0) == l:pdwMax[1] )
return
else
wincmd w
endif
endwhile
"echo 'kicked ' bufname(winbufnr(0))
endfunction
" loads a file
" 파일을 읽습니다.
function LetsLoad()
let l:ppbPathAndFname = SplitFname(@%)
if ( has("browse") )
let l:choice = browse(0, "load a file", l:ppbPathAndFname[0], "*.*")
if ( l:choice == "" )
echo "canceled."
return 7
else
execute "edit! ".l:choice
endif
else "It's a bonus for Vims don't support browse
if ( @% != "" )
execute ":e! ".l:ppbPathAndFname[0]
else
e! $VIM
endif
:setlocal buflisted
:setlocal bufhidden=wipe
endif
endfunction
" Save buffer as a new name. If your Vim does not support browse feature It will cancel.
" 다른이름으로 저장··· browse feature가 지원되지 않는 Vim 에서는 취소됩니다.
function SaveAsNewName()
let l:ppbPathAndFname = SplitFname(@%)
let l:choice = browse(1, "save ".l:ppbPathAndFname[1]." as···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:choice != "" )
execute "saveas! ".l:choice
return 0
else
echo "canceled."
return 7
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" graphical user interface
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if ( has("gui_running") )
" My favorite colorscheme
colorscheme desert
" Font and size
" 글꼴과 창크기
winsize 190 55
set gfn=NanumGothicCoding:h10:b:cHANGEUL
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 단축키 설정 Hotkeys
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 상용구 설정 AutoText
iab xdate <C-R>=strftime("%y-%m-%d %h:%m:%s")<CR>
iab xtime <C-R>=strftime("%h:%m:%s")<CR>
" <F2> 파일 열기 --browse 지원이 없을 때 netrw browser를 사용하게 해놓았습니다.
" <F2> Open a file --browse 지원이 없을 때 netrw browser를 사용하게 해놓았습니다.
map <F2> :call KickCursor()<CR>:call LetsLoad()<CR>
map! <F2> <F2>
" ^_^* "map! <F2> " windows?(Ctrl+Q):(Ctrl+V) (Ctrl+C) "<F2>" dehet···.
" --if your Vim doesn't support browse feature, when it browses fora file to edit it will run "netrw" browser instead of GUI. I recommendyou to edit "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for otherkey. <F1> will be used for other function.
" --만약 당신의 Vim 이 browse feature를 지원하지 않는다면 파일열기를 위한 브라우징은"netrw"를 통해서 이루어질 것입니다. "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" 이 두 파일안에서 <F1> 을 다른 키로변경하시기를 바랍니다. <F1> 은 다른 기능을 위해 사용됩니다.
" loads an empty noname-buffer
" 비어있는 이름없음-버퍼를 불러옵니다.
map <M-F2> :call KickCursor()<CR>:enew!<CR>
map! <M-F2> <M-F2>
" <F3> buffer(not 탭) 닫기
" <F3> discards a buffer
map <F3> :call KickCursor()<CR>:call QuitBuffer()<CR>
map! <F3> <F3>
" Alt+<F3> close all buffers without writing
" Alt+<F3> 모든 버퍼를 저장하지 않고 Vim을 종료합니다.
map <M-F3> :qa!<CR>
map! <M-F3> <M-F3>
" <F1> 이전버퍼 show previous buffer
map <F1> :call KickCursor()<CR>:bprevious!<CR>
map! <F1> <F1>
" <F4> 다음버퍼 show next buffer
map <F4> :call KickCursor()<CR>:bnext!<CR>
map! <F4> <F4>
" <F7> 컴파일 설정 --이건 듀르가 넣은거 아니라 뭔지 잘···
"map <F7> <F8>:!gcc % -o %<<CR>
" <F8> 저장 & taglist update
" <F8> Save & taglist update
map <F8> :call KickCursor()<CR>:w<CR>:TlistUpdate<CR>
map! <F8> <F8>
" Ctrl+<F8> 다른이름으로 저장 & taglist update
" Ctrl+<F8> Save as new name & taglist update
map <C-F8> :call KickCursor()<CR>:call SaveAsNewName()<CR>:TlistUpdate<CR>
map! <C-F8> <C-F8>
" <C-G> 태그 앞으로. 택뒤로=<c-t> 도움말볼때 유용합니다.
" Ctrl+G Jump to newer entry in the tag stack. It is useful when you are reading help text
map <C-G> :tag<CR>
" Ctrl+S CTRL-Z(윈도우에서만 인가?)로 undo한것을 취소하겠습니다. ※※※※※
" Ctrl+S redo. cancels undo(maybe Ctrl+Z). ※※※※※
map <C-S> <C-R>
map! <C-S> <C-R>
" <C-F9> minibufexplorer toggle key
map <C-F9> :TMiniBufExplorer<CR>
map! <C-F9> <C-F9>
" ctrl+f10 taglist toggle
map <C-F10> :TlistToggle<CR>
map! <C-F10> <C-F10>
" Ctrl+<F11> to toggle the menu bar
" Ctrl+<F11> 메뉴바 토글
map <C-F11> :if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif<CR>
map! <C-F11> <C-F11>
" Ctrl+F1 help window··· oops Vim does not support cp949 help-text
"map <C-F1> :help dewrs.txt<CR>
"map! <C-F1> <C-F1>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 기타 설정
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" turn off useless toolbar and menu bar
" 쓸모없는 메뉴바와 툴바를 제거합니다.
set guioptions-=m
set guioptions-=T
" let g:showmarks_ignore_type="hmq" "taglist,mbe 창에서도 뜨면 추하다능··· 난 이제 showmarks 안 씁니다.
" 멋있어 보이기 위해··· EOL표시!
" Do you want to see EOLs?
set lcs=eol:$,tab:\ \
set list
compiler gcc
set ignorecase "ignore case when using a search pattern (대소문자 구분 안함)
set number "show the line number for each line (줄수 보여주기)
set mps+=<:> "matchpairs list of pairs that match for the "%" command (local to buffer) (괄호인식)
set ts=4 "tabstop number of spaces a <Tab> in the text stands for (local to buffer) (탭 4칸이 적절합니다.)
set sw=4 "shiftwidth number of spaces used for each step of (auto)indent (local to buffer) (자동 들여쓰기 탭 4칸이 적절합니다.)
autocmd! BufRead * setlocal bufhidden=hide "do NEVER delete this.
_vimrc <- Click this to download it
자세한 사항은 주석을 참조하세요. 주석 열심히 첨가했습니다.
For the Vimer!
Be happy.
p.s. MiniBufExpl.vim 만드신분이 saveas명령이 떨어졌을때의 처리를 안 해놓으셔서 saveas명령후 :UMiniBufExplorer 명령추천. 근데 제작자가 답변이 없네. 하긴 2004년 11월중순에 나온건데··· 손때셨나?
_vimrc <- Click this to download it
" ※Beta version※ 0.9.02.1
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This is spawned by dewr <wind8702@gmail.com>
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Features
" Move the cursor to the window proper to discard or save. you can designate buffers you dont want to close or to save
" Hotkeys work on Insert mode and Command-line
" 특징
" 커서를 버리거나 저장하기에 적당한 창으로 옯깁니다. 당신은 어떤 버퍼가 닫히거나 저장되지 않을지 지정할 수 있습니다.
" Insert mode나 Command-line 에서도 단축키가 작동합니다.
" ※this script requires browse feature and dialog_gui-or-dialog_con feature.
" --if your Vim doesn't support browse feature, when it browses fora file to edit it will run "netrw" browser instead of GUI. I recommendyou to edit "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for otherkey. <F1> will be used for other function.
" --however, no support for writing without browse feature. (save as new name)
" ※이 스크립트는 browse feature와 dialog_gui-또는-diaolog_con 을 요구합니다.
" --만약 당신의 Vim 이 browse feature를 지원하지 않는다면 파일열기를 위한 브라우징은"netrw"를 통해서 이루어질 것입니다. "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" 이 두 파일안에서 <F1> 을 다른 키로변경하시기를 바랍니다. <F1> 은 다른 기능을 위해 사용됩니다.
" --하지만 browse feature없이 파일쓰기에 대한 지원은 없습니다. (다른이름으로 저장)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" options for functions made by dewr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Is the indicator '/'?
if ( has("win32") || has("os2") ) "works on win-64 also
let g:bDirectoryIndicator = '\\'
let g:bDirectorySlasher = '\'
else
let g:bDirectoryIndicator = '\/'
let g:bDirectorySlasher = '/'
endif
" the two value below is referenced even when Vim chooses a window to save(write), not only when Vim chooses a window to discard
" 아래의 두 변수는 닫을때 만 참조하는 것이 아니라, 저장할 때도 참조됩니다.
let g:ppbNeverClose = [ "-MiniBufExplorer-", "__Tag_List__" ] "the names of buffers you dont want to close. 당신이 닫고 싶지 않은 버퍼들의 이름
let g:ppbDontWannaClose = [ "nofile", "help" ] "Buffer type, leftmostone is the buftype you dont want to close most. 가장 왼쪽에 있는 type이 당신이 가장닫지 않기를 원하는 buftype입니다.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" plugins installed = {ctags, taglist, minibufexplorer, }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" taglist
let Tlist_Use_SingleClick = 1 "prefer to SingleClick
" minibufexplorer
let g:miniBufExplorerMoreThanOne = 0 "show MBE even if there is only a buffer in list.
let g:miniBufExplUseSingleClick = 1 "prefer to SingleClick
" ctags
let g:ctags_statusline=1 " To show tag name in status line.
let generate_tags=1 " To start automatically when a supported file is opened.
let g:ctags_args='-I __declspec+'
" (or whatever other additional arguments you want to pass to ctags)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" jobs in MS Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ftype txtfile="c:\documents and settings\administrator\desktop\d e w r\application\x86-64\vim72\gvim.exe" --remote-silent "%1"
" ftype inifile="c:\documents and settings\administrator\desktop\d e w r\application\x86-64\vim72\gvim.exe" --remote-silent "%1"
"
" ftype code="c:\documents and settings\administrator\desktop\d e w r\application\x86-64\vim72\gvim.exe" --remote-silent "%1"
" assoc .c=code
" assoc .h=code
" assoc .cpp=code
" assoc .vim=inifile
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" out of Vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" "$VIM/vimfiles/plugins/taglist.vim" 의 도움말 단축키가 <F1>인데 ?로 고치는걸 추천합니다. <F1>은 다른 기능을 위해 사용됩니다.
" in "$VIM/vimfiles/plugins/taglist.vim" change <F1> for ?. <F1> will be used for other function.
"
" $vim/vim72/syntax/c.vim 듀르가 애용하는 typedef-keywords···. just for me!
" " my expressions
" syn keyword ctype b_yte w_ord dw_ord qw_ord dwf_loat qwf_loat
" syn keyword ctype ub_yte uw_ord udw_ord uqw_ord udwf_loat uqwf_loat
"
" minibufexpl.vim -> 1079th line has to be fixed like below to show no-name buffers in MBE
" if(strlen(l:bufname)) --> if (1)
" minibufexpl.vim -> 1079번째 줄은 위와 같이 고쳐져야합니다. MBE에 이름없음-버퍼들도 표시하는게 좋기 때문입니다.
" if(strlen(l:bufname)) --> if (1)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" default contents of _vimrc in "gvim for windows on x86-64"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
if ( has("win32") ) "works on win-64 also
source $VIMRUNTIME/mswin.vim
behave mswin
endif
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 =~ g:bDirectorySlasher.'<cmd'
let cmd = '""' . $VIMRUNTIME . g:bDirectorySlasher.'diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . g:bDirectorySlasher.'diff"'
endif
else
let cmd = $VIMRUNTIME . g:bDirectorySlasher.'diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" functions made by dewr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" lTheList 에 pIt이 들어있나 확인하고 없으면 0 있으면 몇번째 원소인지를 리턴합니다.
" return 0 if pIt is not in lTheList, else it returns how many elements before pIt in lTheList.
function IsItInTheList(pIt, lTheList)
let l:dwLength = len(a:lTheList)
let l:dwCounter = 0
while (l:dwLength > l:dwCounter)
if ( a:lTheList[l:dwCounter] == a:pIt )
return l:dwCounter + 1
else
let l:dwCounter += 1
endif
endwhile
return 0
endfunction
" split fname into filename and directory
" 파일명과 디렉토리(위치)로 분리
function SplitFname(pbFname)
let l:pbDir = matchstr(a:pbFname, '.*'.g:bDirectoryIndicator)
let l:pbFile = substitute(a:pbFname, '.*'.g:bDirectoryIndicator, "", "")
let l:ppbReturnv = [ l:pbDir , l:pbFile ]
return l:ppbReturnv
endfunction
" deletes a buffer in current focused window and load another buffer in buffer list or an empty noname-buffer
" 현재창에 떠있는 버퍼를 지우고 버퍼리스트에 있는 다른 버퍼를 부르거나 리스트에 버퍼가 더 없을때는 비어있는 이름없음-버퍼를 띄워놓습니다.
function RunAndGun()
:setlocal bufhidden=hide
let l:dwBufFocused = winbufnr(0)
let l:dwBuffer = bufnr("$")
let l:dwCounter = -1
while ( l:dwBuffer > 0 )
if ( bufexists(l:dwBuffer) && buflisted(l:dwBuffer) && l:dwBuffer != l:dwBufFocused )
let l:dwCounter = l:dwBuffer
break
endif
let l:dwBuffer -= 1
endwhile
if ( l:dwCounter == -1 )
enew!
:setlocal bufhidden=hide
:setlocal buflisted
else
execute "buffer! ".l:dwCounter
endif
execute "bwipeout! ".l:dwBufFocused
endfunction
" save and quit or just quit
function QuitBuffer()
let l:dwBufFocused = winbufnr(0)
if ( !getbufvar(l:dwBufFocused, "&modified") )
call RunAndGun()
return
endif
let l:choice = confirm("save changes of ".@%, "&yes, save\n&no, do not save\n&cancel(esc key)", 2)
if l:choice == 1
if ( @% == "" )
let l:choice = browse(1, "save as···", 0, "")
if ( l:choice == "" )
echo "canceled."
return 7
else
execute "saveas! ".l:choice
endif
else
w
endif
elseif l:choice == 2
echo "didn't save it."
else
echo "canceled."
return 7
endif
call RunAndGun()
return 0
endfunction
" dribble cursor to the window is proper to bother. It references g:ppbNeverClose and g:ppbDontWannaClose.
" 커서를 괴롭히기 좋은 윈도우로 옯깁니다. g:ppbNeverClose 와 g:ppbDontWannaClose 를 참조합니다.
function KickCursor()
let l:pdwMax = [0,0]
let l:dwBuf = 1
let l:dwCounter = 0
let l:dwFirst = winbufnr(0)
let l:dwNow = l:dwFirst "ready to start of the loop
while ( !(l:dwFirst == l:dwNow && l:dwCounter != 0) )
if( buflisted(l:dwNow) )
return
elseif ( !IsItInTheList(bufname(l:dwNow), g:ppbNeverClose) )
let l:dwBuf = IsItInTheList(getbufvar(l:dwNow, "&buftype"), g:ppbDontWannaClose)
if ( !l:dwBuf )
let l:dwBuf = 9999 -l:dwCounter
endif
if (l:dwBuf > l:pdwMax[0])
let l:pdwMax[0] = l:dwBuf
let l:pdwMax[1] = l:dwNow
endif
endif
wincmd w
let l:dwCounter += 1
let l:dwNow = winbufnr(0)
endwhile "end of the loop
while ( l:dwCounter < 87 )
if ( winbufnr(0) == l:pdwMax[1] )
return
else
wincmd w
endif
endwhile
"echo 'kicked ' bufname(winbufnr(0))
endfunction
" loads a file
" 파일을 읽습니다.
function LetsLoad()
let l:ppbPathAndFname = SplitFname(@%)
if ( has("browse") )
let l:choice = browse(0, "load a file", l:ppbPathAndFname[0], "*.*")
if ( l:choice == "" )
echo "canceled."
return 7
else
execute "edit! ".l:choice
endif
else "It's a bonus for Vims don't support browse
if ( @% != "" )
execute ":e! ".l:ppbPathAndFname[0]
else
e! $VIM
endif
:setlocal buflisted
:setlocal bufhidden=wipe
endif
endfunction
" Save buffer as a new name. If your Vim does not support browse feature It will cancel.
" 다른이름으로 저장··· browse feature가 지원되지 않는 Vim 에서는 취소됩니다.
function SaveAsNewName()
let l:ppbPathAndFname = SplitFname(@%)
let l:choice = browse(1, "save ".l:ppbPathAndFname[1]." as···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:choice != "" )
execute "saveas! ".l:choice
return 0
else
echo "canceled."
return 7
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" graphical user interface
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if ( has("gui_running") )
" My favorite colorscheme
colorscheme desert
" Font and size
" 글꼴과 창크기
winsize 190 55
set gfn=NanumGothicCoding:h10:b:cHANGEUL
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 단축키 설정 Hotkeys
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 상용구 설정 AutoText
iab xdate <C-R>=strftime("%y-%m-%d %h:%m:%s")<CR>
iab xtime <C-R>=strftime("%h:%m:%s")<CR>
" <F2> 파일 열기 --browse 지원이 없을 때 netrw browser를 사용하게 해놓았습니다.
" <F2> Open a file --browse 지원이 없을 때 netrw browser를 사용하게 해놓았습니다.
map <F2> :call KickCursor()<CR>:call LetsLoad()<CR>
map! <F2> <F2>
" ^_^* "map! <F2> " windows?(Ctrl+Q):(Ctrl+V) (Ctrl+C) "<F2>" dehet···.
" --if your Vim doesn't support browse feature, when it browses fora file to edit it will run "netrw" browser instead of GUI. I recommendyou to edit "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for otherkey. <F1> will be used for other function.
" --만약 당신의 Vim 이 browse feature를 지원하지 않는다면 파일열기를 위한 브라우징은"netrw"를 통해서 이루어질 것입니다. "$VIM/vim72/autoload/netrw.vim" and"$VIM/vim72/autoload/netrwSettings.vim" 이 두 파일안에서 <F1> 을 다른 키로변경하시기를 바랍니다. <F1> 은 다른 기능을 위해 사용됩니다.
" loads an empty noname-buffer
" 비어있는 이름없음-버퍼를 불러옵니다.
map <M-F2> :call KickCursor()<CR>:enew!<CR>
map! <M-F2> <M-F2>
" <F3> buffer(not 탭) 닫기
" <F3> discards a buffer
map <F3> :call KickCursor()<CR>:call QuitBuffer()<CR>
map! <F3> <F3>
" Alt+<F3> close all buffers without writing
" Alt+<F3> 모든 버퍼를 저장하지 않고 Vim을 종료합니다.
map <M-F3> :qa!<CR>
map! <M-F3> <M-F3>
" <F1> 이전버퍼 show previous buffer
map <F1> :call KickCursor()<CR>:bprevious!<CR>
map! <F1> <F1>
" <F4> 다음버퍼 show next buffer
map <F4> :call KickCursor()<CR>:bnext!<CR>
map! <F4> <F4>
" <F7> 컴파일 설정 --이건 듀르가 넣은거 아니라 뭔지 잘···
"map <F7> <F8>:!gcc % -o %<<CR>
" <F8> 저장 & taglist update
" <F8> Save & taglist update
map <F8> :call KickCursor()<CR>:w<CR>:TlistUpdate<CR>
map! <F8> <F8>
" Ctrl+<F8> 다른이름으로 저장 & taglist update
" Ctrl+<F8> Save as new name & taglist update
map <C-F8> :call KickCursor()<CR>:call SaveAsNewName()<CR>:TlistUpdate<CR>
map! <C-F8> <C-F8>
" <C-G> 태그 앞으로. 택뒤로=<c-t> 도움말볼때 유용합니다.
" Ctrl+G Jump to newer entry in the tag stack. It is useful when you are reading help text
map <C-G> :tag<CR>
" Ctrl+S CTRL-Z(윈도우에서만 인가?)로 undo한것을 취소하겠습니다. ※※※※※
" Ctrl+S redo. cancels undo(maybe Ctrl+Z). ※※※※※
map <C-S> <C-R>
map! <C-S> <C-R>
" <C-F9> minibufexplorer toggle key
map <C-F9> :TMiniBufExplorer<CR>
map! <C-F9> <C-F9>
" ctrl+f10 taglist toggle
map <C-F10> :TlistToggle<CR>
map! <C-F10> <C-F10>
" Ctrl+<F11> to toggle the menu bar
" Ctrl+<F11> 메뉴바 토글
map <C-F11> :if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif<CR>
map! <C-F11> <C-F11>
" Ctrl+F1 help window··· oops Vim does not support cp949 help-text
"map <C-F1> :help dewrs.txt<CR>
"map! <C-F1> <C-F1>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 기타 설정
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" turn off useless toolbar and menu bar
" 쓸모없는 메뉴바와 툴바를 제거합니다.
set guioptions-=m
set guioptions-=T
" let g:showmarks_ignore_type="hmq" "taglist,mbe 창에서도 뜨면 추하다능··· 난 이제 showmarks 안 씁니다.
" 멋있어 보이기 위해··· EOL표시!
" Do you want to see EOLs?
set lcs=eol:$,tab:\ \
set list
compiler gcc
set ignorecase "ignore case when using a search pattern (대소문자 구분 안함)
set number "show the line number for each line (줄수 보여주기)
set mps+=<:> "matchpairs list of pairs that match for the "%" command (local to buffer) (괄호인식)
set ts=4 "tabstop number of spaces a <Tab> in the text stands for (local to buffer) (탭 4칸이 적절합니다.)
set sw=4 "shiftwidth number of spaces used for each step of (auto)indent (local to buffer) (자동 들여쓰기 탭 4칸이 적절합니다.)
autocmd! BufRead * setlocal bufhidden=hide "do NEVER delete this.
_vimrc <- Click this to download it
# by | 2009/02/08 19:13 | IT자료 | 트랙백 | 덧글(0)







☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]