2009년 10월 26일
듀르의 Vim 0.9.10.26
오랜 잠수를 깨고 새 버젼을 배포하게 되어 기쁩니다. //배포라고 쓰고 개인용백업이라고 읽습니다.ㅋ
0.9.10.26 에서 변경된 점들
{
근데 요번에 windows 7에서 사용하면서 느낀건데 Ctrl+Alt+Tab 으로 맵핑한 것을 다른 키로 바꿔야겠더군요. Windows7이 유연하지가 못해서··· Ctrl+Shift+Tab 으로 바꿨습니다.
"새 옵션 g:ppbFilesManaged = [ '\.c', '\.h', '\.vim', 'vimrc' ] " pattern, if one of these patterns matched in a filename, the file will be managed with tagsmanager. 태그매니져가 관리할 파일명,
f8-b:dewr_notagleader변수가 없을 때 오동작되는걸 수정,
f8-새옵션 g:ppbFilesManaged 에 의해 일부 패턴이 포함된 파일명을 가진 파일들만 태그매니져의 관리를 받게 됨,
태그매니져에 Do not link 선택지 추가,
새 옵션 nobk 전 백업파일 만들지 않을겁니다. (편집중에 swp 파일은 생성됨.),
Dewrmswin 위치 변경 ($VIM/vimfiles/after),
Dewrs_vimrc_example.vim 까지 배포(배포라고 쓰고 개인용 백업이라고 읽는다.),
<C-U> 도입 (visual block(텍스트 선택)된 상태에서 함수 호출시 줄수만큼 반복되던 문제 해결)
}
p.s. 저의 vimrc나 미숙한 영어에 대한 조언들을 해주세요.
_vimrc - click this to download <- This is big :)
Dewrs_mswin.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_vimrc_example.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_minibufexpl.vim - click this to download <- copy into your plugin directory
Dewrs_taglist.vim - clilck this to download <- copy into your plugin directory
"version 0.9.10.26
"TODO:
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" ※This is made by dewr <wind8702@gmail.com>
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Features
" We will move the cursor to the window proper to discard or save. you can designate buffers you dont want to close or to save (also when you clicked a content in Dewrs_minibufexpl.vim)
" Hotkeys work on Insert mode and Command-line
" Makes browsing quick and easy
" Manages tags files for omni-completion (Tags-Manager contains informations of Tag-Leader files, Tag-Leader files contain informations of a tags file and work directories.)
" Datas in the buffer you've seen won't be lost.
" 특징
" 커서를 버리거나 저장하기에 적당한 창으로 옯깁니다. 당신은 어떤 버퍼가 닫히거나 저장되지 않을지 지정할 수 있습니다. (Dewrs_minibufexpl.vim 에서 클릭할 때에도)
" Insert mode나 Command-line 에서도 단축키가 작동합니다.
" 빠르고 쉽게 돌아다니게 해드립니다.
" Omni-completion(자동완성)을 위한 tags파일들을 관리해드립니다. (Tags-Manager 는 Tag-Leader파일들의 정보를 담고 있고, Tag-Leader파일들은 tags파일과 작업디렉토리들의 정보를 담고 있습니다.)
" 당신이 본 버퍼들은 화면에서 사라져도 내용이 보존됩니다.
" ※this script requires browse feature and dialog_gui-or-dialog_con feature.
" --if your Vim doesn't support browse feature, when it browses for a file to edit it will run "netrw" browser instead of GUI. I recommend you to edit "$VIM/vim72/autoload/netrw.vim" and "$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for other key. <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없이 파일쓰기에 대한 지원은 없습니다. (다른이름으로 저장)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※table of contents
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Introduction
"Table of contents
"Options for functions made by dewr
"Plugins installed
"Jobs in MS windows
"Out of vim
"Graphical user interface
"Simple contents of _vimrc are little different from default contents of _vimrc
"Functions made by dewr
"Hotkeys
"Initialization and Splash!
"Other configurations
"The last code(Tell vim to remember certain things when we exit)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※options for functions made by dewr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"path to the tags manager file
let g:pbTagsManagerFile = $VIM . "/TManager"
"Is the indicator '/'?
if ( has("win32") || has("os2") ) "works on win-64 also
let g:pbDirectorySlasherSpecial = "\\\\"
let g:bDirectorySlasher = '\'
else
let g:pbDirectorySlasherSpecial = '\/'
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', 'quickfix' ] "Buffer type, leftmost one is the buftype you dont want to close most. 가장 왼쪽에 있는 type이 당신이 가장 닫지 않기를 원하는 buftype입니다.
let g:ppbFilesManaged = [ '\.c', '\.h', '\.vim', 'vimrc' ] " pattern, if one of these patterns matched in a filename, the file will be managed with tagsmanager. 태그매니져가 관리할 파일명
"I don't use this!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※plugins installed = { Dewrs_taglist, Dewrs_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
let g:miniBufExplMapCTabSwitchWindows = 1 "use Ctrl-Tab and Ctrl-Shift-Tab to move cursor to the next and previous window.
" supertab
"let g:SuperTabDefaultCompletionType = "<c-x><c-o>" "use omni-completion
" c.vim
let g:C_LFlags = "-Wall -O2 -mtune=core2" "_I am using this.
"let g:C_LFlags = "-Wall -g -O0" "_This is default.
let g:C_CFlags = g:C_LFlags . " -c"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※jobs in MS Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function JobsInMSW()
"you have to do this with sudo(Super-User-Do = Administrator's authority in Windows 7)
call RunSCommand('ftype txtfile="'.$VIMRUNTIME.'\gvim.exe" --remote-silent "%1"')
call RunSCommand('ftype inifile="'.$VIMRUNTIME.'\gvim.exe" --remote-silent "%1"')
call RunSCommand('ftype code="'.$VIMRUNTIME.'\gvim.exe" --remote-silent "%1"')
call RunSCommand('assoc .c=code')
call RunSCommand('assoc .h=code')
call RunSCommand('assoc .cpp=code')
call RunSCommand('assoc .vim=code')
call RunSCommand('assoc .tl=code')
call RunSCommand('assoc .tags=code')
" It won't work perfectly -.,-; but I dont know why it won't.
" you have to do assoc-commands in cmd-shell yourself like below after you do ':call JobsInMSW()'
" assoc .c=code
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※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
"You don't need to read text about minibufexpl.vim. just download Dewrs_minibufexpl.vim.
" 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 -> 1362th 1364th 1366th line: delete these lines containing "wincmd w"
" minibufexpl.vim -> 1361th 1363th 1365th line: change these for "if (!KickCursor() && g:miniBufExplModSelTarget == 1) || bufname('%') == '-MiniBufExplorer-'"
" minibufexpl.vim -> put this code between two endif in 562th line "exec ':map! <silent> <LEFTMOUSE> <LEFTMOUSE>' . '' . s:clickmap"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※graphical user interface
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if ( has("gui_running") )
if ( has("win32") && !has("win32unix") )
endif
set gfn=NanumGothicCoding:h10:cHANGEUL
endif
winsize 190 55
" My favorite colorscheme
colorscheme desert
"move cursor when you click middle mouse button
map <MiddleMouse> :call DewrMiddleMouse()<CR><MiddleMouse>
map! <MiddleMouse> <MiddleMouse>
map <2-MiddleMouse> <MiddleMouse>
map! <2-MiddleMouse> <MiddleMouse>
map <3-MiddleMouse> <MiddleMouse>
map! <3-MiddleMouse> <MiddleMouse>
map <4-MiddleMouse> <MiddleMouse>
map! <4-MiddleMouse> <MiddleMouse>
function DewrMiddleMouse()
call getchar()
if ( v:mouse_win < 1 )
return 7
endif
execute v:mouse_win."wincmd w"
execute v:mouse_lnum
execute "normal ".v:mouse_col."|"
return 0
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※These are little different from default contents of _vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
source $VIM/vimfiles/after/Dewrs_vimrc_example.vim
if ( has("win32") ) "works on win-64 also
source $VIM/vimfiles/after/Dewrs_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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ppbTLs = [] "Tag-Leader files list
set ignorecase "ignore case when using a search pattern. do NEVER delete this. (대소문자 구분 안함)
autocmd BufEnter * setlocal bufhidden=hide "do NEVER delete this making buffers stable.
" 절대 지우지 마세요. 버퍼들을 휘발성이지 않게 만드는 겁니다.
autocmd BufReadPost * call TakeDewrCommands() "run Dewr_C:commands which are at bottom of the file.
" 파일 맨 아랫줄에 있는 Dewr_C:명령어들을 수행합니다.
"autocmd
" 리스트에 있는 버퍼들을 모두 훑어보면서 저장할지말지 물어봅니다.
" Sweeping buffers in the list and asks you whether to save or not
function Sweeping()
call KickCursor()
bnext!
bprevious!
let l:dwBufFocused = winbufnr(0)
let l:dwNow = l:dwBufFocused
while ( 1 )
if ( &modified )
let l:choice = confirm("save changes of ".l:dwNow.":".@%, "&Yes, save\n&No, do not save\n&Cancel(esc)", 2)
if ( l:choice == 1 )
if ( @% == "" )
if ( SaveAsNewName() )
"echo "canceled."
execute "buffer! ".l:dwBufFocused
return 7
else
"echo "saved."
"execute "bwipeout! ".l:dwNow
endif
else
w
endif
elseif ( l:choice == 2 )
"echo "didn't save it."
else
"echo "canceled."
execute "buffer! ".l:dwBufFocused
return 7
endif
endif
bprevious!
let l:dwNow = winbufnr(0)
if ( l:dwBufFocused == l:dwNow )
break
endif
endwhile
return 0
endfunction
function QuitVim()
if ( Sweeping() )
"echo "canceled."
return 7
else
qa!
endif
endfunction
" 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
" deletes the buffer in current focused window and load another buffer in buffer list or an empty noname-buffer
" 현재창에 떠있는 버퍼를 지우고 버퍼리스트에 있는 다른 버퍼를 부르거나 리스트에 버퍼가 더 없을때는 비어있는 이름없음-버퍼를 띄워놓습니다.
function RunAndGun()
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!
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 ( !&modified )
call RunAndGun()
return 0
endif
let l:choice = confirm("save changes of ".l:dwBufFocused.":".@%, "&Yes, save\n&No, do not save\n&Cancel(esc)", 2)
if ( l:choice == 1 )
if ( @% == "" )
if ( SaveAsNewName() )
"echo "canceled."
return 7
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
" else--elseif
if ( !IsItInTheList(bufname(l:dwNow), g:ppbNeverClose) )
let l:dwBuf = IsItInTheList(&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] = winnr()
endif
endif
wincmd w
let l:dwCounter += 1
let l:dwNow = winbufnr(0)
endwhile "end of the loop
if ( l:pdwMax[1] == 0 )
return 7
endif
while ( 1 )
if ( winnr() == l:pdwMax[1] )
return 0
else
wincmd w
endif
endwhile
"echo 'kicked ' bufname(winbufnr(0))
endfunction
" checks if pbFname is loaded and returns buffer-number of the file and if the file is loaded.
" Vim에 pbFname 이라는 이름의 파일이 로드된 경우 버퍼번호를 리턴하옵니다.
function IsTheFileLoaded(pbFname)
let l:dwFirst = winbufnr(0)
let l:pbFname = fnamemodify(a:pbFname, ":p")
let l:dwBuffer = bufnr("$")
while ( l:dwBuffer > 0 )
if ( bufexists(l:dwBuffer) )
execute "buffer! ".l:dwBuffer
if ( fnamemodify(@%, ":p") == l:pbFname )
execute "buffer! ".l:dwFirst
return l:dwBuffer
endif
endif
let l:dwBuffer -= 1
endwhile
execute "buffer! ".l:dwFirst
return 0
endfunction
" It's not being used.
function IsTheBufOnTheScreen(dwTheBuf)
let l:pdwWindows = []
let l:pdwReturn = []
let l:dwQWindows = 0
let l:dwCr = winnr("$")
while ( l:dwCr != 0 )
if (dwTheBuf == winbufnr(l:dwCr))
let l:dwQWindows += 1
call add(l:pdwWindows, l:dwCr)
endif
let l:dwCr -= 1
endwhile
call add(l:pdwReturn, l:dwQWindows)
let l:pdwReturn += l:pdwWindows
return l:pdwReturn
endfunction
" loads a file
" 파일을 읽습니다.
function LetsLoad()
let l:ppbPathAndFname = [fnamemodify(@%,":p:h"),fnamemodify(@%, ":t")]
if ( has("browse") )
let l:fname = browse(0, "load a file", l:ppbPathAndFname[0], "*.*")
if ( l:fname == "" )
"echo "canceled."
return 7
else
execute "edit! ".l:fname
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
" 다른이름으로 저장···
function SaveAsNewName()
let l:dwFirst = winbufnr(0)
let l:ppbPathAndFname = [fnamemodify(@%,":p:h"),fnamemodify(@%, ":t")]
while ( 1 )
let l:fname = browse(1, "save ".l:ppbPathAndFname[1]." as···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:fname != "" )
if ( findfile(l:fname) != "" )
let l:choice = confirm("overwrite to ".l:fname, "&Yes, overwrite\n&No, let me browse more(esc)\n&Cancel", 1)
if ( l:choice == 3 )
"echo "canceled."
return 7
elseif ( l:choice == 1 )
let l:same = 0
if ( @% != l:fname )
let l:same = IsTheFileLoaded(l:fname)
endif
if ( l:same )
let l:choice = confirm("Oops! ".l:fname." is loaded in another buffer! Are you sure to delete this buffer and overwrite?", "&Yes, overwrite.\n&No, let me browse more(esc)", 2)
if ( l:choice == 1 )
execute "buffer! ".l:same
call RunAndGun()
execute "buffer! ".l:dwFirst
else
echo "browsing again."
continue
endif
endif
execute "saveas! ".l:fname
"echo "overwrited."
return 0
else
echo "browsing again."
continue
endif
else
execute "saveas! ".l:fname
return 0
endif
else
"echo "canceled."
return 7
endif
endwhile
endfunction
" Make tags. it requires g:Tlist_Ctags_Cmd in taglist.vim
" tags를 생성합니다. g:Tlist_Ctags_Cmd in taglist.vim이 필요합니다.
function MakeTags(pbFname, pbTagFile)
" Exuberant ctags arguments to generate a tag list
let ctags_args = " --c++-kinds=+p --fields=+iaS --extra=+q -a"
" Ctags command to produce output with regexp for locating the tags
let ctags_cmd = g:Tlist_Ctags_Cmd . ' -f "' . fnamemodify(a:pbTagFile, ":p") . '"' . ctags_args
let ctags_cmd = ctags_cmd . ' "' . fnamemodify(a:pbFname, ":p") . '"'
" Run ctags and get the tag list
if ( RunSCommand(ctags_cmd) )
return 7
else
echo "tags has made."
endif
endfunction
" Run shell command well anywhere(?)
" Shell command 를 아무데서나(?) 실행함
function RunSCommand(pbCommand)
let l:pbCommand = a:pbCommand
if &shellxquote == '"'
" Double-quotes within double-quotes will not work in the
" command-line.If the 'shellxquote' option is set to double-quotes,
" then escape the double-quotes in the ctags command-line.
let l:pbCommand = escape(l:pbCommand, '"')
endif
" In Windows 95, if not using cygwin, disable the 'shellslash'
" option. Otherwise, this will cause problems when running the
" ctags command.
if has('win95') && !has('win32unix')
let old_shellslash = &shellslash
set noshellslash
endif
" Run ctags and get the tag list
let cmd_output = system(l:pbCommand)
" Restore the value of the 'shellslash' option.
if has('win95') && !has('win32unix')
let &shellslash = old_shellslash
endif
" Handle errors
if v:shell_error
echo "shell_error: ". cmd_output
return 7
else
return 0
endif
endfunction
" load g:ppbTagsManagerFile.
" g:ppbTagsManagerFile 을 읽어요.
function LoadTMFile()
let l:dwCounter = 0
let l:ppbBuffers = [ "" ]
let l:pbBuffer = findfile(g:pbTagsManagerFile)
if ( l:pbBuffer == "" )
echo "there is not the Tags-Manager."
return 7
endif
let l:TM = readfile(g:pbTagsManagerFile)
let l:dwLength = len(l:TM)
if ( !l:dwLength )
echo "Tags-Manager file is empty. :q"
return 7
endif
let g:ppbTLs = split(l:TM[0], "{Dewr}")
let l:dwLength = len(g:ppbTLs)
let l:ppbTagsFiles = split(&tags, ",")
while ( l:dwCounter < l:dwLength )
let l:pbBuffer = findfile(g:ppbTLs[l:dwCounter])
if ( l:pbBuffer != "" )
let l:ppbBuffers = readfile(g:ppbTLs[l:dwCounter])
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
let l:ppbBuffers[0] = escape(l:ppbBuffers[0], ' ')
if ( !IsItInTheList(l:ppbBuffers[0], l:ppbTagsFiles) )
let &tags = &tags . ',' . l:ppbBuffers[0]
endif
endif
let l:dwCounter += 1
endwhile
endfunction
"Decide whether to manage with Tags-manager or do nothing
"태그매니져로 관리하거나 아무짓도 안 하거나를 결정
function ManageOrNot(pbFname)
let l:pbFname = fnamemodify(a:pbFname, ":t")
let l:ppbBuffer = ["zero", "one"]
let l:dwLen = len(g:ppbFilesManaged)
let l:dwCtr = 0
while (l:dwCtr < l:dwLen)
let l:ppbBuffer = split(l:pbFname, g:ppbFilesManaged[l:dwCtr])
if ( l:ppbBuffer[0] != l:pbFname )
echo l:ppbBuffer[0]
return 7 "call Manager
endif
let l:dwCtr = l:dwCtr+1
endwhile
return 0
endfunction
" Requests a tags file.
" tags파일 요청.
function TagFileRequest(pbFname)
let l:dwCounter = 0
let l:pbBuffer = ""
let l:ppbBuffers = [ 0 ]
let l:dwLength = len(g:ppbTLs)
while ( l:dwCounter < l:dwLength )
let l:pbBuffer = findfile(g:ppbTLs[l:dwCounter])
if ( l:pbBuffer != "" )
let l:ppbBuffers = readfile(g:ppbTLs[l:dwCounter])
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
if ( IsItInTheList(fnamemodify(a:pbFname, ":p:h"), l:ppbBuffers) )
if ( MakeTags(a:pbFname, l:ppbBuffers[0]) )
"echo "canceled."
return 7
else
return 0
endif
endif
endif
let l:dwCounter += 1
endwhile
let l:dwBuffer = confirm("There isn't Tag-Leader file linked to base directory of ".a:pbFname." ···What would you do?", "&Make a new Tag-Leader file\n&Link to a Tag-Leader file\nDo ¬ link it\n&Cancel(esc)", 2)
if ( l:dwBuffer == 1 )
let l:pbBuffer = MakeTagLeader(a:pbFname)
if ( l:pbBuffer == "")
echo "failed to make tag-leader file."
return 7
endif
if ( LoadTLFile(l:pbBuffer) )
"echo "failed."
return 7
endif
let l:ppbBuffers = readfile(l:pbBuffer)
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p:h")
if ( writefile(l:ppbBuffers, l:pbBuffer) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
elseif ( l:dwBuffer == 2 )
let l:dwCounter = 0
let l:pbBuffer = "&Another Tag-Leader file\n"
while ( l:dwCounter < l:dwLength )
let l:pbBuffer = l:pbBuffer . g:ppbTLs[l:dwCounter] . "\n"
let l:dwCounter += 1
endwhile
let l:pbBuffer = l:pbBuffer . "&Cancel(esc)"
let l:dwBuffer = confirm("What Tag-Leader file do you want to link base directory of ".a:pbFname." to?", l:pbBuffer, 1)
if ( l:dwBuffer > 1 && l:dwBuffer != l:dwLength + 2 )
let l:ppbBuffers = readfile(g:ppbTLs[l:dwBuffer-2])
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p:h")
if ( writefile(l:ppbBuffers, g:ppbTLs[l:dwBuffer-2]) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
let l:pbBuffer = l:ppbBuffers[0]
elseif ( l:dwBuffer == 1 )
let l:pbBuffer = MakeTagLeader(a:pbFname)
if ( l:pbBuffer == "")
echo "failed to make tag-leader file."
return 7
endif
if ( LoadTLFile(l:pbBuffer) )
"echo "failed."
return 7
endif
let l:ppbBuffers = readfile(l:pbBuffer)
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p:h")
if ( writefile(l:ppbBuffers, l:pbBuffer) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
else
"echo "canceled."
return 7
endif
elseif ( l:dwBuffer == 3 )
return 0
else
"echo "canceled."
return 7
endif
if ( MakeTags(a:pbFname, l:ppbBuffers[0]) )
"echo "canceled."
return 7
else
return 0
endif
endfunction
" Append pbDir to pbTLFile
" pbDir을 pbTLFile에 덧붙입니다.
function AppendDirToTLFile(pbDir, pbTLFile)
let l:ppbBuffers = readfile(a:pbTLFile)
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbDir, ":p:h")
if ( writefile(l:ppbBuffers, a:pbTLFile) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
endfunction
" Browse to make a Tag-Leader file
" Tag-Leader 파일 만들기 위해서 브라우저를 엽니다.
function MakeTagLeader(pbFname)
let l:dwFirst = winbufnr(0)
enew!
let l:ppbPathAndFname = [$HOME, '.tl']
while ( 1 )
let l:fname = browse(1, "Making a tag-leader file of ".a:pbFname."···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:fname != "" )
if ( findfile(l:fname) != "" )
let l:choice = confirm("overwrite to ".l:fname, "&Yes, overwrite\n&No, let me browse more(esc)\n&Cancel", 1)
if ( l:choice == 3 )
"echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
elseif ( l:choice == 1 )
let l:same = IsTheFileLoaded(l:fname)
if ( l:same )
let l:choice = confirm("Oops! ".l:fname." is loaded in another buffer! Are you sure to delete this buffer and overwrite?", "&Yes, overwrite.\n&No, let me browse more(esc)", 2)
if ( l:choice == 1 )
execute "buffer! ".l:same
call RunAndGun()
execute "buffer! ".l:dwFirst
else
echo "browsing again."
continue
endif
endif
let l:tagsfname = BrowseForNewTagsFile(l:fname)
if ( l:tagsfname == "" )
echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
if ( writefile([fnamemodify(l:tagsfname,":p"),"Tag-Leaer files contain path of tags file and linked directories."], l:fname) )
echo "failed to write \"".l:fname."\"···."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
"echo "overwrited."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return l:fname
else
echo "browsing again."
continue
endif
else
let l:tagsfname = BrowseForNewTagsFile(l:fname)
if ( l:tagsfname == "" )
echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
if ( writefile([fnamemodify(l:tagsfname,":p"),"Tag-Leaer files contain path of tags file and linked directories."], l:fname) )
echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return l:fname
endif
else
"echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
endwhile
endfunction
function BrowseForNewTagsFile(pbFname)
let l:dwFirst = winbufnr(0)
let l:ppbPathAndFname = [$HOME, '.tags']
while ( 1 )
let l:fname = browse(1, "Making the tags file of ".a:pbFname."···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:fname != "" )
if ( findfile(l:fname) != "" )
let l:choice = confirm("overwrite to ".l:fname, "&Yes, overwrite\n&No, let me browse more(esc)\n&Cancel", 1)
if ( l:choice == 3 )
"echo "canceled."
return ""
elseif ( l:choice == 1 )
let l:same = IsTheFileLoaded(l:fname)
if ( l:same )
let l:choice = confirm("Oops! ".l:fname." is loaded in another buffer! Are you sure to delete this buffer and overwrite?", "&Yes, overwrite.\n&No, let me browse more(esc)", 2)
if ( l:choice == 1 )
execute "buffer! ".l:same
call RunAndGun()
execute "buffer! ".l:dwFirst
else
echo "browsing again."
continue
endif
endif
if ( delete(l:fname) )
echo "failed to delete ". l:fname
return ""
endif
"echo "overwrited."
return l:fname
else
echo "browsing again."
continue
endif
else
return l:fname
endif
else
"echo "canceled."
return ""
endif
endwhile
endfunction
" Load a Tag-Leader file.
" Tag-Leader파일을 읽어옵니다.
function LoadTLFile(pbFname)
let l:dwLength = 0
let l:ppbBuffers = [ "" ]
"append tags file to 'tags' option
let l:pbBuffer = findfile(a:pbFname)
if ( l:pbBuffer != "" )
let l:ppbTagsFiles = split(&tags, ",")
let l:ppbBuffers = readfile(a:pbFname)
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
let l:ppbBuffers[0] = escape(l:ppbBuffers[0], ' ')
if ( !IsItInTheList(l:ppbBuffers[0], l:ppbTagsFiles) )
let &tags = &tags . ',' . l:ppbBuffers[0]
endif
else
echo "failed to find \"".a:pbFname."\"···."
return 7
endif
let l:pbFind = findfile(g:pbTagsManagerFile)
if ( l:pbFind == "" )
let l:ppbBuffers[0] = fnamemodify(a:pbFname, ":p")
call add(l:ppbBuffers, "Tags-Manager files contain paths of Tag-Leader files.")
else
let l:ppbBuffers = readfile(g:pbTagsManagerFile)
let l:dwLength = len(l:ppbBuffers)
if ( !l:dwLength )
let l:ppbBuffers[0] = fnamemodify(a:pbFname, ":p")
call add(l:ppbBuffers, "Tags-Manager files contain paths of Tag-Leader files.")
else
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p")
endif
endif
if ( writefile(l:ppbBuffers, g:pbTagsManagerFile) )
echo "failed to append \"".l:pbBuffer."\" to the Tag-Manager file."
return 7
endif
call add(g:ppbTLs, a:pbFname)
return 0
endfunction
"Last Dewr-Command must be at the last line of the file. Format = ?Dewr_C:{CODE}
function TakeDewrCommands()
let l:dwLastLine = line("$")
let l:ppbCheckup = split(getline(l:dwLastLine), "Dewr_C:")
if ( len(l:ppbCheckup) != 2 || len(l:ppbCheckup[0]) > 2 )
return 7
endif
let l:ppbBuffers = [ "echo \" Dewr_C has taken.\"" ]
call add(l:ppbBuffers, l:ppbCheckup[1])
" let l:pbBuffer = ""
let l:dwBuffer = l:dwLastLine -1
while ( 1 )
let l:ppbCheckup = split(getline(l:dwBuffer), "Dewr_C:")
if ( len(l:ppbCheckup) !=2 || len(l:ppbCheckup[0]) > 2 )
break
endif
call add(l:ppbBuffers, l:ppbCheckup[1])
let l:dwBuffer -= 1
endwhile
let l:dwBuffer = len(l:ppbBuffers) - 1
while ( l:dwBuffer >= 0 )
execute l:ppbBuffers[l:dwBuffer]
let l:dwBuffer -= 1
endwhile
return 0
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※단축키 설정 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>
" keymapping :~~~ as visual block mode makes vim to deliver range informations (e.g. :'<,'>~~~ ) so function calls repeat as much as the number of selected(block) textlines, so add <C-U> at your key mapping command. (e.g. :<C-U>call KickCursor() )
" 블럭모드의 :~~~ 키맵핑은 vim이 범위정보를 전달하게 만듭니다. (이렇게 :`<,`>~~~ ) 그래서 함수호출은 블럭지정(선택)되어있는 텍스트 줄수만큼 연속적으로 호출됩니다. 그러니 키맵핑할때 꼭 <C-U> 넣으세요. (이렇게 :<C-U>call KickCursor() )
vmap <F2> :<C-U>call KickCursor()<CR>:call LetsLoad()<CR>
" ^_^* "map! <F2> " windows?(Ctrl+Q):(Ctrl+V) (Ctrl+C) "<F2>" dehet···.
" --if your Vim doesn't support browse feature, when it browses for a file to edit it will run "netrw" browser instead of GUI. I recommend you to edit "$VIM/vim72/autoload/netrw.vim" and "$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for other key. <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>
vmap <M-F2> :<C-U>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>
vmap <F3> :<C-U>call KickCursor()<CR>:call QuitBuffer()<CR>
map! <F3> <F3>
" Alt+<F3> quit Vim
" Alt+<F3> Vim 종료
map <M-F3> :call QuitVim()<CR>
vmap <M-F3> :<C-U>call QuitVim()<CR>
map! <M-F3> <M-F3>
" Alt+Q close a window
" Alt+Q 창 닫기
map <M-q> :call AltQ()<CR>
vmap <M-q> :<C-U>call AltQ()<CR>
map! <M-q> <M-q>
function AltQ()
let l:dwBufFocused = winbufnr(0)
if ( &modified )
let l:choice = confirm("save changes of ".l:dwBufFocused.":".@%, "&Yes, save\n&No, do not save\n&Cancel(esc)", 2)
if ( l:choice == 1 )
if ( @% == "" )
if ( SaveAsNewName() )
"echo "canceled."
return 7
endif
else
w
endif
elseif ( l:choice == 2 )
"echo "didn't save it."
else
"echo "canceled."
return 7
endif
endif
if ( @% != "" || &buftype != "" )
setlocal bufhidden=hide
enew!
else
bwipeout!
return 0
endif
if ( !getbufvar(l:dwBufFocused, "&modifiable") || !buflisted(l:dwBufFocused) )
execute "bwipeout! ".l:dwBufFocused
endif
return 0
endfunction
" <F1> 이전버퍼 show previous buffer
map <F1> :call KickCursor()<CR>:bprevious!<CR>
vmap <F1> :<C-U>call KickCursor()<CR>:bprevious!<CR>
map! <F1> <F1>
" <F4> 다음버퍼 show next buffer
map <F4> :call KickCursor()<CR>:bnext!<CR>
vmap <F4> :<C-U>call KickCursor()<CR>:bnext!<CR>
map! <F4> <F4>
" <F8> 저장 & taglist update & [ omni자동완성을 위한 tags파일 생성 ]
" <F8> Save & taglist update & [ make tags file for omni-comletion ]
map <F8> :call KickCursor()<CR>:update!<CR>:TlistUpdate<CR>:if exists("b:dewr_notagleader") \| echo "b:dewr_notagleader" \| else \| if (ManageOrNot(bufname("%"))) \| call TagFileRequest(@%) \| else \| echo "This has not managed by tags-manager." \| endif \| endif<CR>
vmap <F8> :<C-U>call KickCursor()<CR>:update!<CR>:TlistUpdate<CR>:if exists("b:dewr_notagleader") \| echo "b:dewr_notagleader" \| else \| if (ManageOrNot(bufname("%"))) \| call TagFileRequest(@%) \| else \| echo "This has not managed by tags-manager." \| endif \| endif<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>:UMiniBufExplorer<CR>:TlistUpdate<CR>
vmap <C-F8> :<C-U>call KickCursor()<CR>:call SaveAsNewName()<CR>:UMiniBufExplorer<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>
vmap <C-G> :<C-U>tag<CR>
" Ctrl+R CTRL-Z(윈도우에서만 인가?)로 undo한것을 취소하겠습니다. ※※※※※
" Ctrl+R redo. cancels undo(maybe Ctrl+Z). ※※※※※
map! <C-R> <C-R>
" <C-F9> minibufexplorer toggle key
map <C-F9> :TMiniBufExplorer<CR>
vmap <C-F9> :<C-U>TMiniBufExplorer<CR>
map! <C-F9> <C-F9>
" ctrl+f10 taglist toggle
map <C-F10> :TlistToggle<CR>
vmap <C-F10> :<C-U>TlistToggle<CR>
map! <C-F10> <C-F10>
" Ctrl+<F12> to toggle the menu bar
" Ctrl+<F12> 메뉴바 토글
map <C-F12> :if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif<CR>
vmap <C-F12> :<C-U>if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif<CR>
map! <C-F12> <C-F12>
" 쓰는 법: Ctrl-Q + <C-C>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※Initialization and Splash!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function DewrSplash()
echo " Dewr's Vim! 0.9.2.4"
echo "\n"
echo " Dewr's_Vim!_D"
echo " De ewr's_V"
echo " ew r's_"
echo " ew r's"
echo " wr 's"
echo " wr 's"
echo " rs _V"
echo " rs _V"
echo " 's _V"
echo " 's _V"
echo " 's _V"
echo " 's _V"
echo " Vi m!"
echo " Vi m!"
echo " im !_"
echo " im !_"
echo " m! Dew"
echo " m!_Dewr"
echo "\n"
echo "\n Click_below_to_start_vim."
endfunction
"autocmd GUIEnter * call DewrSplash() "··· :q
function DewrsIntroduction()
:TlistOpen
call KickCursor()
call LoadTMFile()
endfunction
autocmd VimEnter * call DewrsIntroduction()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※기타 설정 other configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" turn off useless toolbar and menu bar
" 쓸모없는 메뉴바와 툴바를 제거합니다.
set guioptions-=m
set guioptions-=T
"turn off backup
set nobackup
"mapleader
let g:maplocalleader = "\\" " = '\'
let g:mapleader = ","
" let g:showmarks_ignore_type="hmq" "taglist,mbe 창에서도 뜨면 추하다능··· 난 showmarks 안 씁니다.
" 멋있어 보이기 위해··· EOL표시!
" Do you want to see EOLs?
set lcs=eol:$,tab:\ \
set list
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set completeopt=menuone,preview ":help 'completeopt
compiler gcc
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칸이 적절합니다.)
"
"
"
"
" 마지막에 편집하던 파일들을 다시 불러오기. vimrc의 마지막코드여야 하네요.
" Tell vim to remember certain things when we exit. this must be the last code in vimrc.
" '16 : marks will be remembered for up to 16 previously edited files
" "1000 : will save up to 1000 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='16,\"1000,:20,%,n~/_viminfo
"Last Dewr-Command must be at the last line of the file. Format = ?Dewr_C:{CODE}
"Dewr_C:echo "Hello! World!1"
"Dewr_C:echo "Hello! World!2"
"Dewr_C:echo "Hello! World!3"
_vimrc - click this to download <- This is big :)
Dewrs_mswin.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_vimrc_example.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_minibufexpl.vim - click this to download <- copy into your plugin directory
Dewrs_taglist.vim - clilck this to download <- copy into your plugin directory
0.9.10.26 에서 변경된 점들
{
근데 요번에 windows 7에서 사용하면서 느낀건데 Ctrl+Alt+Tab 으로 맵핑한 것을 다른 키로 바꿔야겠더군요. Windows7이 유연하지가 못해서··· Ctrl+Shift+Tab 으로 바꿨습니다.
"새 옵션 g:ppbFilesManaged = [ '\.c', '\.h', '\.vim', 'vimrc' ] " pattern, if one of these patterns matched in a filename, the file will be managed with tagsmanager. 태그매니져가 관리할 파일명,
f8-b:dewr_notagleader변수가 없을 때 오동작되는걸 수정,
f8-새옵션 g:ppbFilesManaged 에 의해 일부 패턴이 포함된 파일명을 가진 파일들만 태그매니져의 관리를 받게 됨,
태그매니져에 Do not link 선택지 추가,
새 옵션 nobk 전 백업파일 만들지 않을겁니다. (편집중에 swp 파일은 생성됨.),
Dewrmswin 위치 변경 ($VIM/vimfiles/after),
Dewrs_vimrc_example.vim 까지 배포(배포라고 쓰고 개인용 백업이라고 읽는다.),
<C-U> 도입 (visual block(텍스트 선택)된 상태에서 함수 호출시 줄수만큼 반복되던 문제 해결)
}
p.s. 저의 vimrc나 미숙한 영어에 대한 조언들을 해주세요.
_vimrc - click this to download <- This is big :)
Dewrs_mswin.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_vimrc_example.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_minibufexpl.vim - click this to download <- copy into your plugin directory
Dewrs_taglist.vim - clilck this to download <- copy into your plugin directory
"version 0.9.10.26
"TODO:
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" ※This is made by dewr <wind8702@gmail.com>
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Features
" We will move the cursor to the window proper to discard or save. you can designate buffers you dont want to close or to save (also when you clicked a content in Dewrs_minibufexpl.vim)
" Hotkeys work on Insert mode and Command-line
" Makes browsing quick and easy
" Manages tags files for omni-completion (Tags-Manager contains informations of Tag-Leader files, Tag-Leader files contain informations of a tags file and work directories.)
" Datas in the buffer you've seen won't be lost.
" 특징
" 커서를 버리거나 저장하기에 적당한 창으로 옯깁니다. 당신은 어떤 버퍼가 닫히거나 저장되지 않을지 지정할 수 있습니다. (Dewrs_minibufexpl.vim 에서 클릭할 때에도)
" Insert mode나 Command-line 에서도 단축키가 작동합니다.
" 빠르고 쉽게 돌아다니게 해드립니다.
" Omni-completion(자동완성)을 위한 tags파일들을 관리해드립니다. (Tags-Manager 는 Tag-Leader파일들의 정보를 담고 있고, Tag-Leader파일들은 tags파일과 작업디렉토리들의 정보를 담고 있습니다.)
" 당신이 본 버퍼들은 화면에서 사라져도 내용이 보존됩니다.
" ※this script requires browse feature and dialog_gui-or-dialog_con feature.
" --if your Vim doesn't support browse feature, when it browses for a file to edit it will run "netrw" browser instead of GUI. I recommend you to edit "$VIM/vim72/autoload/netrw.vim" and "$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for other key. <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없이 파일쓰기에 대한 지원은 없습니다. (다른이름으로 저장)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※table of contents
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Introduction
"Table of contents
"Options for functions made by dewr
"Plugins installed
"Jobs in MS windows
"Out of vim
"Graphical user interface
"Simple contents of _vimrc are little different from default contents of _vimrc
"Functions made by dewr
"Hotkeys
"Initialization and Splash!
"Other configurations
"The last code(Tell vim to remember certain things when we exit)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※options for functions made by dewr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"path to the tags manager file
let g:pbTagsManagerFile = $VIM . "/TManager"
"Is the indicator '/'?
if ( has("win32") || has("os2") ) "works on win-64 also
let g:pbDirectorySlasherSpecial = "\\\\"
let g:bDirectorySlasher = '\'
else
let g:pbDirectorySlasherSpecial = '\/'
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', 'quickfix' ] "Buffer type, leftmost one is the buftype you dont want to close most. 가장 왼쪽에 있는 type이 당신이 가장 닫지 않기를 원하는 buftype입니다.
let g:ppbFilesManaged = [ '\.c', '\.h', '\.vim', 'vimrc' ] " pattern, if one of these patterns matched in a filename, the file will be managed with tagsmanager. 태그매니져가 관리할 파일명
"I don't use this!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※plugins installed = { Dewrs_taglist, Dewrs_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
let g:miniBufExplMapCTabSwitchWindows = 1 "use Ctrl-Tab and Ctrl-Shift-Tab to move cursor to the next and previous window.
" supertab
"let g:SuperTabDefaultCompletionType = "<c-x><c-o>" "use omni-completion
" c.vim
let g:C_LFlags = "-Wall -O2 -mtune=core2" "_I am using this.
"let g:C_LFlags = "-Wall -g -O0" "_This is default.
let g:C_CFlags = g:C_LFlags . " -c"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※jobs in MS Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function JobsInMSW()
"you have to do this with sudo(Super-User-Do = Administrator's authority in Windows 7)
call RunSCommand('ftype txtfile="'.$VIMRUNTIME.'\gvim.exe" --remote-silent "%1"')
call RunSCommand('ftype inifile="'.$VIMRUNTIME.'\gvim.exe" --remote-silent "%1"')
call RunSCommand('ftype code="'.$VIMRUNTIME.'\gvim.exe" --remote-silent "%1"')
call RunSCommand('assoc .c=code')
call RunSCommand('assoc .h=code')
call RunSCommand('assoc .cpp=code')
call RunSCommand('assoc .vim=code')
call RunSCommand('assoc .tl=code')
call RunSCommand('assoc .tags=code')
" It won't work perfectly -.,-; but I dont know why it won't.
" you have to do assoc-commands in cmd-shell yourself like below after you do ':call JobsInMSW()'
" assoc .c=code
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※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
"You don't need to read text about minibufexpl.vim. just download Dewrs_minibufexpl.vim.
" 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 -> 1362th 1364th 1366th line: delete these lines containing "wincmd w"
" minibufexpl.vim -> 1361th 1363th 1365th line: change these for "if (!KickCursor() && g:miniBufExplModSelTarget == 1) || bufname('%') == '-MiniBufExplorer-'"
" minibufexpl.vim -> put this code between two endif in 562th line "exec ':map! <silent> <LEFTMOUSE> <LEFTMOUSE>' . '' . s:clickmap"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※graphical user interface
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if ( has("gui_running") )
if ( has("win32") && !has("win32unix") )
endif
set gfn=NanumGothicCoding:h10:cHANGEUL
endif
winsize 190 55
" My favorite colorscheme
colorscheme desert
"move cursor when you click middle mouse button
map <MiddleMouse> :call DewrMiddleMouse()<CR><MiddleMouse>
map! <MiddleMouse> <MiddleMouse>
map <2-MiddleMouse> <MiddleMouse>
map! <2-MiddleMouse> <MiddleMouse>
map <3-MiddleMouse> <MiddleMouse>
map! <3-MiddleMouse> <MiddleMouse>
map <4-MiddleMouse> <MiddleMouse>
map! <4-MiddleMouse> <MiddleMouse>
function DewrMiddleMouse()
call getchar()
if ( v:mouse_win < 1 )
return 7
endif
execute v:mouse_win."wincmd w"
execute v:mouse_lnum
execute "normal ".v:mouse_col."|"
return 0
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※These are little different from default contents of _vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
source $VIM/vimfiles/after/Dewrs_vimrc_example.vim
if ( has("win32") ) "works on win-64 also
source $VIM/vimfiles/after/Dewrs_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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ppbTLs = [] "Tag-Leader files list
set ignorecase "ignore case when using a search pattern. do NEVER delete this. (대소문자 구분 안함)
autocmd BufEnter * setlocal bufhidden=hide "do NEVER delete this making buffers stable.
" 절대 지우지 마세요. 버퍼들을 휘발성이지 않게 만드는 겁니다.
autocmd BufReadPost * call TakeDewrCommands() "run Dewr_C:commands which are at bottom of the file.
" 파일 맨 아랫줄에 있는 Dewr_C:명령어들을 수행합니다.
"autocmd
" 리스트에 있는 버퍼들을 모두 훑어보면서 저장할지말지 물어봅니다.
" Sweeping buffers in the list and asks you whether to save or not
function Sweeping()
call KickCursor()
bnext!
bprevious!
let l:dwBufFocused = winbufnr(0)
let l:dwNow = l:dwBufFocused
while ( 1 )
if ( &modified )
let l:choice = confirm("save changes of ".l:dwNow.":".@%, "&Yes, save\n&No, do not save\n&Cancel(esc)", 2)
if ( l:choice == 1 )
if ( @% == "" )
if ( SaveAsNewName() )
"echo "canceled."
execute "buffer! ".l:dwBufFocused
return 7
else
"echo "saved."
"execute "bwipeout! ".l:dwNow
endif
else
w
endif
elseif ( l:choice == 2 )
"echo "didn't save it."
else
"echo "canceled."
execute "buffer! ".l:dwBufFocused
return 7
endif
endif
bprevious!
let l:dwNow = winbufnr(0)
if ( l:dwBufFocused == l:dwNow )
break
endif
endwhile
return 0
endfunction
function QuitVim()
if ( Sweeping() )
"echo "canceled."
return 7
else
qa!
endif
endfunction
" 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
" deletes the buffer in current focused window and load another buffer in buffer list or an empty noname-buffer
" 현재창에 떠있는 버퍼를 지우고 버퍼리스트에 있는 다른 버퍼를 부르거나 리스트에 버퍼가 더 없을때는 비어있는 이름없음-버퍼를 띄워놓습니다.
function RunAndGun()
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!
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 ( !&modified )
call RunAndGun()
return 0
endif
let l:choice = confirm("save changes of ".l:dwBufFocused.":".@%, "&Yes, save\n&No, do not save\n&Cancel(esc)", 2)
if ( l:choice == 1 )
if ( @% == "" )
if ( SaveAsNewName() )
"echo "canceled."
return 7
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
" else--elseif
if ( !IsItInTheList(bufname(l:dwNow), g:ppbNeverClose) )
let l:dwBuf = IsItInTheList(&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] = winnr()
endif
endif
wincmd w
let l:dwCounter += 1
let l:dwNow = winbufnr(0)
endwhile "end of the loop
if ( l:pdwMax[1] == 0 )
return 7
endif
while ( 1 )
if ( winnr() == l:pdwMax[1] )
return 0
else
wincmd w
endif
endwhile
"echo 'kicked ' bufname(winbufnr(0))
endfunction
" checks if pbFname is loaded and returns buffer-number of the file and if the file is loaded.
" Vim에 pbFname 이라는 이름의 파일이 로드된 경우 버퍼번호를 리턴하옵니다.
function IsTheFileLoaded(pbFname)
let l:dwFirst = winbufnr(0)
let l:pbFname = fnamemodify(a:pbFname, ":p")
let l:dwBuffer = bufnr("$")
while ( l:dwBuffer > 0 )
if ( bufexists(l:dwBuffer) )
execute "buffer! ".l:dwBuffer
if ( fnamemodify(@%, ":p") == l:pbFname )
execute "buffer! ".l:dwFirst
return l:dwBuffer
endif
endif
let l:dwBuffer -= 1
endwhile
execute "buffer! ".l:dwFirst
return 0
endfunction
" It's not being used.
function IsTheBufOnTheScreen(dwTheBuf)
let l:pdwWindows = []
let l:pdwReturn = []
let l:dwQWindows = 0
let l:dwCr = winnr("$")
while ( l:dwCr != 0 )
if (dwTheBuf == winbufnr(l:dwCr))
let l:dwQWindows += 1
call add(l:pdwWindows, l:dwCr)
endif
let l:dwCr -= 1
endwhile
call add(l:pdwReturn, l:dwQWindows)
let l:pdwReturn += l:pdwWindows
return l:pdwReturn
endfunction
" loads a file
" 파일을 읽습니다.
function LetsLoad()
let l:ppbPathAndFname = [fnamemodify(@%,":p:h"),fnamemodify(@%, ":t")]
if ( has("browse") )
let l:fname = browse(0, "load a file", l:ppbPathAndFname[0], "*.*")
if ( l:fname == "" )
"echo "canceled."
return 7
else
execute "edit! ".l:fname
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
" 다른이름으로 저장···
function SaveAsNewName()
let l:dwFirst = winbufnr(0)
let l:ppbPathAndFname = [fnamemodify(@%,":p:h"),fnamemodify(@%, ":t")]
while ( 1 )
let l:fname = browse(1, "save ".l:ppbPathAndFname[1]." as···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:fname != "" )
if ( findfile(l:fname) != "" )
let l:choice = confirm("overwrite to ".l:fname, "&Yes, overwrite\n&No, let me browse more(esc)\n&Cancel", 1)
if ( l:choice == 3 )
"echo "canceled."
return 7
elseif ( l:choice == 1 )
let l:same = 0
if ( @% != l:fname )
let l:same = IsTheFileLoaded(l:fname)
endif
if ( l:same )
let l:choice = confirm("Oops! ".l:fname." is loaded in another buffer! Are you sure to delete this buffer and overwrite?", "&Yes, overwrite.\n&No, let me browse more(esc)", 2)
if ( l:choice == 1 )
execute "buffer! ".l:same
call RunAndGun()
execute "buffer! ".l:dwFirst
else
echo "browsing again."
continue
endif
endif
execute "saveas! ".l:fname
"echo "overwrited."
return 0
else
echo "browsing again."
continue
endif
else
execute "saveas! ".l:fname
return 0
endif
else
"echo "canceled."
return 7
endif
endwhile
endfunction
" Make tags. it requires g:Tlist_Ctags_Cmd in taglist.vim
" tags를 생성합니다. g:Tlist_Ctags_Cmd in taglist.vim이 필요합니다.
function MakeTags(pbFname, pbTagFile)
" Exuberant ctags arguments to generate a tag list
let ctags_args = " --c++-kinds=+p --fields=+iaS --extra=+q -a"
" Ctags command to produce output with regexp for locating the tags
let ctags_cmd = g:Tlist_Ctags_Cmd . ' -f "' . fnamemodify(a:pbTagFile, ":p") . '"' . ctags_args
let ctags_cmd = ctags_cmd . ' "' . fnamemodify(a:pbFname, ":p") . '"'
" Run ctags and get the tag list
if ( RunSCommand(ctags_cmd) )
return 7
else
echo "tags has made."
endif
endfunction
" Run shell command well anywhere(?)
" Shell command 를 아무데서나(?) 실행함
function RunSCommand(pbCommand)
let l:pbCommand = a:pbCommand
if &shellxquote == '"'
" Double-quotes within double-quotes will not work in the
" command-line.If the 'shellxquote' option is set to double-quotes,
" then escape the double-quotes in the ctags command-line.
let l:pbCommand = escape(l:pbCommand, '"')
endif
" In Windows 95, if not using cygwin, disable the 'shellslash'
" option. Otherwise, this will cause problems when running the
" ctags command.
if has('win95') && !has('win32unix')
let old_shellslash = &shellslash
set noshellslash
endif
" Run ctags and get the tag list
let cmd_output = system(l:pbCommand)
" Restore the value of the 'shellslash' option.
if has('win95') && !has('win32unix')
let &shellslash = old_shellslash
endif
" Handle errors
if v:shell_error
echo "shell_error: ". cmd_output
return 7
else
return 0
endif
endfunction
" load g:ppbTagsManagerFile.
" g:ppbTagsManagerFile 을 읽어요.
function LoadTMFile()
let l:dwCounter = 0
let l:ppbBuffers = [ "" ]
let l:pbBuffer = findfile(g:pbTagsManagerFile)
if ( l:pbBuffer == "" )
echo "there is not the Tags-Manager."
return 7
endif
let l:TM = readfile(g:pbTagsManagerFile)
let l:dwLength = len(l:TM)
if ( !l:dwLength )
echo "Tags-Manager file is empty. :q"
return 7
endif
let g:ppbTLs = split(l:TM[0], "{Dewr}")
let l:dwLength = len(g:ppbTLs)
let l:ppbTagsFiles = split(&tags, ",")
while ( l:dwCounter < l:dwLength )
let l:pbBuffer = findfile(g:ppbTLs[l:dwCounter])
if ( l:pbBuffer != "" )
let l:ppbBuffers = readfile(g:ppbTLs[l:dwCounter])
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
let l:ppbBuffers[0] = escape(l:ppbBuffers[0], ' ')
if ( !IsItInTheList(l:ppbBuffers[0], l:ppbTagsFiles) )
let &tags = &tags . ',' . l:ppbBuffers[0]
endif
endif
let l:dwCounter += 1
endwhile
endfunction
"Decide whether to manage with Tags-manager or do nothing
"태그매니져로 관리하거나 아무짓도 안 하거나를 결정
function ManageOrNot(pbFname)
let l:pbFname = fnamemodify(a:pbFname, ":t")
let l:ppbBuffer = ["zero", "one"]
let l:dwLen = len(g:ppbFilesManaged)
let l:dwCtr = 0
while (l:dwCtr < l:dwLen)
let l:ppbBuffer = split(l:pbFname, g:ppbFilesManaged[l:dwCtr])
if ( l:ppbBuffer[0] != l:pbFname )
echo l:ppbBuffer[0]
return 7 "call Manager
endif
let l:dwCtr = l:dwCtr+1
endwhile
return 0
endfunction
" Requests a tags file.
" tags파일 요청.
function TagFileRequest(pbFname)
let l:dwCounter = 0
let l:pbBuffer = ""
let l:ppbBuffers = [ 0 ]
let l:dwLength = len(g:ppbTLs)
while ( l:dwCounter < l:dwLength )
let l:pbBuffer = findfile(g:ppbTLs[l:dwCounter])
if ( l:pbBuffer != "" )
let l:ppbBuffers = readfile(g:ppbTLs[l:dwCounter])
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
if ( IsItInTheList(fnamemodify(a:pbFname, ":p:h"), l:ppbBuffers) )
if ( MakeTags(a:pbFname, l:ppbBuffers[0]) )
"echo "canceled."
return 7
else
return 0
endif
endif
endif
let l:dwCounter += 1
endwhile
let l:dwBuffer = confirm("There isn't Tag-Leader file linked to base directory of ".a:pbFname." ···What would you do?", "&Make a new Tag-Leader file\n&Link to a Tag-Leader file\nDo ¬ link it\n&Cancel(esc)", 2)
if ( l:dwBuffer == 1 )
let l:pbBuffer = MakeTagLeader(a:pbFname)
if ( l:pbBuffer == "")
echo "failed to make tag-leader file."
return 7
endif
if ( LoadTLFile(l:pbBuffer) )
"echo "failed."
return 7
endif
let l:ppbBuffers = readfile(l:pbBuffer)
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p:h")
if ( writefile(l:ppbBuffers, l:pbBuffer) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
elseif ( l:dwBuffer == 2 )
let l:dwCounter = 0
let l:pbBuffer = "&Another Tag-Leader file\n"
while ( l:dwCounter < l:dwLength )
let l:pbBuffer = l:pbBuffer . g:ppbTLs[l:dwCounter] . "\n"
let l:dwCounter += 1
endwhile
let l:pbBuffer = l:pbBuffer . "&Cancel(esc)"
let l:dwBuffer = confirm("What Tag-Leader file do you want to link base directory of ".a:pbFname." to?", l:pbBuffer, 1)
if ( l:dwBuffer > 1 && l:dwBuffer != l:dwLength + 2 )
let l:ppbBuffers = readfile(g:ppbTLs[l:dwBuffer-2])
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p:h")
if ( writefile(l:ppbBuffers, g:ppbTLs[l:dwBuffer-2]) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
let l:pbBuffer = l:ppbBuffers[0]
elseif ( l:dwBuffer == 1 )
let l:pbBuffer = MakeTagLeader(a:pbFname)
if ( l:pbBuffer == "")
echo "failed to make tag-leader file."
return 7
endif
if ( LoadTLFile(l:pbBuffer) )
"echo "failed."
return 7
endif
let l:ppbBuffers = readfile(l:pbBuffer)
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p:h")
if ( writefile(l:ppbBuffers, l:pbBuffer) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
else
"echo "canceled."
return 7
endif
elseif ( l:dwBuffer == 3 )
return 0
else
"echo "canceled."
return 7
endif
if ( MakeTags(a:pbFname, l:ppbBuffers[0]) )
"echo "canceled."
return 7
else
return 0
endif
endfunction
" Append pbDir to pbTLFile
" pbDir을 pbTLFile에 덧붙입니다.
function AppendDirToTLFile(pbDir, pbTLFile)
let l:ppbBuffers = readfile(a:pbTLFile)
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbDir, ":p:h")
if ( writefile(l:ppbBuffers, a:pbTLFile) )
echo "writing Tag-Leader file failed."
return 7
endif
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
endfunction
" Browse to make a Tag-Leader file
" Tag-Leader 파일 만들기 위해서 브라우저를 엽니다.
function MakeTagLeader(pbFname)
let l:dwFirst = winbufnr(0)
enew!
let l:ppbPathAndFname = [$HOME, '.tl']
while ( 1 )
let l:fname = browse(1, "Making a tag-leader file of ".a:pbFname."···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:fname != "" )
if ( findfile(l:fname) != "" )
let l:choice = confirm("overwrite to ".l:fname, "&Yes, overwrite\n&No, let me browse more(esc)\n&Cancel", 1)
if ( l:choice == 3 )
"echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
elseif ( l:choice == 1 )
let l:same = IsTheFileLoaded(l:fname)
if ( l:same )
let l:choice = confirm("Oops! ".l:fname." is loaded in another buffer! Are you sure to delete this buffer and overwrite?", "&Yes, overwrite.\n&No, let me browse more(esc)", 2)
if ( l:choice == 1 )
execute "buffer! ".l:same
call RunAndGun()
execute "buffer! ".l:dwFirst
else
echo "browsing again."
continue
endif
endif
let l:tagsfname = BrowseForNewTagsFile(l:fname)
if ( l:tagsfname == "" )
echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
if ( writefile([fnamemodify(l:tagsfname,":p"),"Tag-Leaer files contain path of tags file and linked directories."], l:fname) )
echo "failed to write \"".l:fname."\"···."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
"echo "overwrited."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return l:fname
else
echo "browsing again."
continue
endif
else
let l:tagsfname = BrowseForNewTagsFile(l:fname)
if ( l:tagsfname == "" )
echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
if ( writefile([fnamemodify(l:tagsfname,":p"),"Tag-Leaer files contain path of tags file and linked directories."], l:fname) )
echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return l:fname
endif
else
"echo "canceled."
"call QuitBuffer()
setlocal bufhidden=wipe
execute "buffer!". l:dwFirst
return ""
endif
endwhile
endfunction
function BrowseForNewTagsFile(pbFname)
let l:dwFirst = winbufnr(0)
let l:ppbPathAndFname = [$HOME, '.tags']
while ( 1 )
let l:fname = browse(1, "Making the tags file of ".a:pbFname."···", l:ppbPathAndFname[0], l:ppbPathAndFname[1])
if ( l:fname != "" )
if ( findfile(l:fname) != "" )
let l:choice = confirm("overwrite to ".l:fname, "&Yes, overwrite\n&No, let me browse more(esc)\n&Cancel", 1)
if ( l:choice == 3 )
"echo "canceled."
return ""
elseif ( l:choice == 1 )
let l:same = IsTheFileLoaded(l:fname)
if ( l:same )
let l:choice = confirm("Oops! ".l:fname." is loaded in another buffer! Are you sure to delete this buffer and overwrite?", "&Yes, overwrite.\n&No, let me browse more(esc)", 2)
if ( l:choice == 1 )
execute "buffer! ".l:same
call RunAndGun()
execute "buffer! ".l:dwFirst
else
echo "browsing again."
continue
endif
endif
if ( delete(l:fname) )
echo "failed to delete ". l:fname
return ""
endif
"echo "overwrited."
return l:fname
else
echo "browsing again."
continue
endif
else
return l:fname
endif
else
"echo "canceled."
return ""
endif
endwhile
endfunction
" Load a Tag-Leader file.
" Tag-Leader파일을 읽어옵니다.
function LoadTLFile(pbFname)
let l:dwLength = 0
let l:ppbBuffers = [ "" ]
"append tags file to 'tags' option
let l:pbBuffer = findfile(a:pbFname)
if ( l:pbBuffer != "" )
let l:ppbTagsFiles = split(&tags, ",")
let l:ppbBuffers = readfile(a:pbFname)
let l:ppbBuffers = split(l:ppbBuffers[0], "{Dewr}")
let l:ppbBuffers[0] = escape(l:ppbBuffers[0], ' ')
if ( !IsItInTheList(l:ppbBuffers[0], l:ppbTagsFiles) )
let &tags = &tags . ',' . l:ppbBuffers[0]
endif
else
echo "failed to find \"".a:pbFname."\"···."
return 7
endif
let l:pbFind = findfile(g:pbTagsManagerFile)
if ( l:pbFind == "" )
let l:ppbBuffers[0] = fnamemodify(a:pbFname, ":p")
call add(l:ppbBuffers, "Tags-Manager files contain paths of Tag-Leader files.")
else
let l:ppbBuffers = readfile(g:pbTagsManagerFile)
let l:dwLength = len(l:ppbBuffers)
if ( !l:dwLength )
let l:ppbBuffers[0] = fnamemodify(a:pbFname, ":p")
call add(l:ppbBuffers, "Tags-Manager files contain paths of Tag-Leader files.")
else
let l:ppbBuffers[0] = l:ppbBuffers[0] . "{Dewr}" . fnamemodify(a:pbFname, ":p")
endif
endif
if ( writefile(l:ppbBuffers, g:pbTagsManagerFile) )
echo "failed to append \"".l:pbBuffer."\" to the Tag-Manager file."
return 7
endif
call add(g:ppbTLs, a:pbFname)
return 0
endfunction
"Last Dewr-Command must be at the last line of the file. Format = ?Dewr_C:{CODE}
function TakeDewrCommands()
let l:dwLastLine = line("$")
let l:ppbCheckup = split(getline(l:dwLastLine), "Dewr_C:")
if ( len(l:ppbCheckup) != 2 || len(l:ppbCheckup[0]) > 2 )
return 7
endif
let l:ppbBuffers = [ "echo \" Dewr_C has taken.\"" ]
call add(l:ppbBuffers, l:ppbCheckup[1])
" let l:pbBuffer = ""
let l:dwBuffer = l:dwLastLine -1
while ( 1 )
let l:ppbCheckup = split(getline(l:dwBuffer), "Dewr_C:")
if ( len(l:ppbCheckup) !=2 || len(l:ppbCheckup[0]) > 2 )
break
endif
call add(l:ppbBuffers, l:ppbCheckup[1])
let l:dwBuffer -= 1
endwhile
let l:dwBuffer = len(l:ppbBuffers) - 1
while ( l:dwBuffer >= 0 )
execute l:ppbBuffers[l:dwBuffer]
let l:dwBuffer -= 1
endwhile
return 0
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※단축키 설정 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>
" keymapping :~~~ as visual block mode makes vim to deliver range informations (e.g. :'<,'>~~~ ) so function calls repeat as much as the number of selected(block) textlines, so add <C-U> at your key mapping command. (e.g. :<C-U>call KickCursor() )
" 블럭모드의 :~~~ 키맵핑은 vim이 범위정보를 전달하게 만듭니다. (이렇게 :`<,`>~~~ ) 그래서 함수호출은 블럭지정(선택)되어있는 텍스트 줄수만큼 연속적으로 호출됩니다. 그러니 키맵핑할때 꼭 <C-U> 넣으세요. (이렇게 :<C-U>call KickCursor() )
vmap <F2> :<C-U>call KickCursor()<CR>:call LetsLoad()<CR>
" ^_^* "map! <F2> " windows?(Ctrl+Q):(Ctrl+V) (Ctrl+C) "<F2>" dehet···.
" --if your Vim doesn't support browse feature, when it browses for a file to edit it will run "netrw" browser instead of GUI. I recommend you to edit "$VIM/vim72/autoload/netrw.vim" and "$VIM/vim72/autoload/netrwSettings.vim" to change <F1> for other key. <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>
vmap <M-F2> :<C-U>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>
vmap <F3> :<C-U>call KickCursor()<CR>:call QuitBuffer()<CR>
map! <F3> <F3>
" Alt+<F3> quit Vim
" Alt+<F3> Vim 종료
map <M-F3> :call QuitVim()<CR>
vmap <M-F3> :<C-U>call QuitVim()<CR>
map! <M-F3> <M-F3>
" Alt+Q close a window
" Alt+Q 창 닫기
map <M-q> :call AltQ()<CR>
vmap <M-q> :<C-U>call AltQ()<CR>
map! <M-q> <M-q>
function AltQ()
let l:dwBufFocused = winbufnr(0)
if ( &modified )
let l:choice = confirm("save changes of ".l:dwBufFocused.":".@%, "&Yes, save\n&No, do not save\n&Cancel(esc)", 2)
if ( l:choice == 1 )
if ( @% == "" )
if ( SaveAsNewName() )
"echo "canceled."
return 7
endif
else
w
endif
elseif ( l:choice == 2 )
"echo "didn't save it."
else
"echo "canceled."
return 7
endif
endif
if ( @% != "" || &buftype != "" )
setlocal bufhidden=hide
enew!
else
bwipeout!
return 0
endif
if ( !getbufvar(l:dwBufFocused, "&modifiable") || !buflisted(l:dwBufFocused) )
execute "bwipeout! ".l:dwBufFocused
endif
return 0
endfunction
" <F1> 이전버퍼 show previous buffer
map <F1> :call KickCursor()<CR>:bprevious!<CR>
vmap <F1> :<C-U>call KickCursor()<CR>:bprevious!<CR>
map! <F1> <F1>
" <F4> 다음버퍼 show next buffer
map <F4> :call KickCursor()<CR>:bnext!<CR>
vmap <F4> :<C-U>call KickCursor()<CR>:bnext!<CR>
map! <F4> <F4>
" <F8> 저장 & taglist update & [ omni자동완성을 위한 tags파일 생성 ]
" <F8> Save & taglist update & [ make tags file for omni-comletion ]
map <F8> :call KickCursor()<CR>:update!<CR>:TlistUpdate<CR>:if exists("b:dewr_notagleader") \| echo "b:dewr_notagleader" \| else \| if (ManageOrNot(bufname("%"))) \| call TagFileRequest(@%) \| else \| echo "This has not managed by tags-manager." \| endif \| endif<CR>
vmap <F8> :<C-U>call KickCursor()<CR>:update!<CR>:TlistUpdate<CR>:if exists("b:dewr_notagleader") \| echo "b:dewr_notagleader" \| else \| if (ManageOrNot(bufname("%"))) \| call TagFileRequest(@%) \| else \| echo "This has not managed by tags-manager." \| endif \| endif<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>:UMiniBufExplorer<CR>:TlistUpdate<CR>
vmap <C-F8> :<C-U>call KickCursor()<CR>:call SaveAsNewName()<CR>:UMiniBufExplorer<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>
vmap <C-G> :<C-U>tag<CR>
" Ctrl+R CTRL-Z(윈도우에서만 인가?)로 undo한것을 취소하겠습니다. ※※※※※
" Ctrl+R redo. cancels undo(maybe Ctrl+Z). ※※※※※
map! <C-R> <C-R>
" <C-F9> minibufexplorer toggle key
map <C-F9> :TMiniBufExplorer<CR>
vmap <C-F9> :<C-U>TMiniBufExplorer<CR>
map! <C-F9> <C-F9>
" ctrl+f10 taglist toggle
map <C-F10> :TlistToggle<CR>
vmap <C-F10> :<C-U>TlistToggle<CR>
map! <C-F10> <C-F10>
" Ctrl+<F12> to toggle the menu bar
" Ctrl+<F12> 메뉴바 토글
map <C-F12> :if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif<CR>
vmap <C-F12> :<C-U>if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif<CR>
map! <C-F12> <C-F12>
" 쓰는 법: Ctrl-Q + <C-C>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※Initialization and Splash!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function DewrSplash()
echo " Dewr's Vim! 0.9.2.4"
echo "\n"
echo " Dewr's_Vim!_D"
echo " De ewr's_V"
echo " ew r's_"
echo " ew r's"
echo " wr 's"
echo " wr 's"
echo " rs _V"
echo " rs _V"
echo " 's _V"
echo " 's _V"
echo " 's _V"
echo " 's _V"
echo " Vi m!"
echo " Vi m!"
echo " im !_"
echo " im !_"
echo " m! Dew"
echo " m!_Dewr"
echo "\n"
echo "\n Click_below_to_start_vim."
endfunction
"autocmd GUIEnter * call DewrSplash() "··· :q
function DewrsIntroduction()
:TlistOpen
call KickCursor()
call LoadTMFile()
endfunction
autocmd VimEnter * call DewrsIntroduction()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ※기타 설정 other configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" turn off useless toolbar and menu bar
" 쓸모없는 메뉴바와 툴바를 제거합니다.
set guioptions-=m
set guioptions-=T
"turn off backup
set nobackup
"mapleader
let g:maplocalleader = "\\" " = '\'
let g:mapleader = ","
" let g:showmarks_ignore_type="hmq" "taglist,mbe 창에서도 뜨면 추하다능··· 난 showmarks 안 씁니다.
" 멋있어 보이기 위해··· EOL표시!
" Do you want to see EOLs?
set lcs=eol:$,tab:\ \
set list
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set completeopt=menuone,preview ":help 'completeopt
compiler gcc
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칸이 적절합니다.)
"
"
"
"
" 마지막에 편집하던 파일들을 다시 불러오기. vimrc의 마지막코드여야 하네요.
" Tell vim to remember certain things when we exit. this must be the last code in vimrc.
" '16 : marks will be remembered for up to 16 previously edited files
" "1000 : will save up to 1000 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='16,\"1000,:20,%,n~/_viminfo
"Last Dewr-Command must be at the last line of the file. Format = ?Dewr_C:{CODE}
"Dewr_C:echo "Hello! World!1"
"Dewr_C:echo "Hello! World!2"
"Dewr_C:echo "Hello! World!3"
_vimrc - click this to download <- This is big :)
Dewrs_mswin.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_vimrc_example.vim - click this to download <- copy into $VIM/vimfiles/after
Dewrs_minibufexpl.vim - click this to download <- copy into your plugin directory
Dewrs_taglist.vim - clilck this to download <- copy into your plugin directory
# by | 2009/10/26 19:54 | IT자료 | 트랙백 | 핑백(1) | 덧글(1)







☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
... 립니다. 듀르: 프로필 사진을 업로드했고 적용하기를 눌렀습니다만 그 문제는 여전히 남아있습니다. 11월 5일이글루스운영자: Dewr 님의 블로그를 확인해 보니, http://dewr.egloos.com/5152701 포스트 내 등록된 본문 내용(특수문자)으로 인해 RSS 페이지가 영향을 받은 듯 합니다. Dewr 님께서 본문 내용을 점검하시어, 해당 글을 수정하시거나 ... more