2009년 02월 27일
듀르의 Vim 0.9.2.4 이것말고 최신버젼을 받으세요. 꼭
_vimrc <-Click this to download it.
Dewrs_minibufexpl.vim <-Click this to download it.
taglist.vim <-Click this to download it.
netrw.vim_and_netrwSettings.vim.7z <-Click this to download it.
0.9.2.5 예고 = {
***치명적버그 수정(noname buffer에서 저장안함을 눌렀을때 다른 noname buffer를 닫아버릴수있음!)***
Alt+Q가 그냥 윈도우만 닫는거였는데 버퍼를 꺼버리게 변경. (한번누르면 버퍼를 지워버리고(버퍼리스트에 있고 modifiable속성이 있으면 지우지 않음) 노네임버퍼로 놓고 노네임버퍼면서 저장할사항 없으면 윈도우 제거)
Alt+F3으로 종료할 때 버퍼리스트에 있는 버퍼를 표시하고있는 창이 하나도 없었을때 무한루프에 빠지는 현상 수정.
!~파일 오픈시 맨 아랫줄이 [두글자이하].Dewr_C:.[한글자이상]로 시작한다면 ( ex>"Dewr_C:echo "hello" || //Dewr_C:let b:dewr_notagleader=1 ) 그 위의 Dewr_C들중 제일 위의 Dewr_C:명령어"부터 차례대로 명령어 처리한다.
f8이 write명령 쓰던거 update명령으로 교체(update와 달리 write는 변경사항이 없어도 씀)
!~F8 눌렀을때 b:dewr_notagleader != 0 일 경우 tag-leader 관련 작업을 수행하지 않고 파일변경사항update+TagList플러긴에 TlistUpdate만 함.(TIP※File 맨 아랫줄에 //Dewr_C:let b:dewr_notagleader = 1 해 놓으면 그 파일 열때마다 :dewr_notagleader=1 이 생기겠죠!)
~!!!!!~include문을 보고 해당 파일의 tags파일 생성···하게만들까 하다가 귀찮아서 취소.
Dewrs_mswin.vim 배포 mswin에서 내가 안 쓰는 부분을 주석처리해버림.
추천플러긴에서 supertab 제거.
맵리더를 comma(,)로 설정··· 기본값은 \입니다.
편리한 단축키들을 더 보강;
Dewrs_minibufexpl.vim 에서 마우스중간버튼(휠) 클릭시 버퍼닫기; C-TAB과 Ctrl+Alt+TAB이 삽입수정모드에서도 커서워프를 수행함
}
0.9.2.3f 에서 변경된 점 = {
Sweeping 함수가 현재버퍼부터 검사하지 않고 바로 앞 버퍼부터 검사하는 걸 고쳤음.
당신이 보았던 버퍼들은 창에서 사라져도 내용이 보존됩니다. 버퍼리스트에서 없어지면 날라가지만···.;
Alt+Q 창닫기; Alt+F3에서 KickCursor함수를 쓸데없이 호출하는 걸 삭제;
omni-completion을 위한 tags를 생성하는 도구들(TagLeader File(*.tl)이 한 프로젝트에 연관된디렉토리경로들을 갖고있고 해당 디렉토리에 있는 코드파일은 자동으로 해당 TagLeader가 가르키는 ctags파일에 tags가덧붙여진다;
kickcursor함수가 ppbNeverClose멤버인 버퍼만 열려있을 때 호출됬을 경우 무한루프발생하는걸 처치;
supertab 추가(안깔아도 상관없지만 추천!);
내가 만든 함수 splitfname을 버리고 내장함수들을 사용···그리고 기타 내장스크립트기능을 적극활용하고 내가 만든 긴 코드 삭제;
KickCursor함수가 같은버퍼가 여러창에 띄어져 있을 때 더러운 기분을 줄 수 있는걸 고침;
Win32환경이 아닌 다른 환경에서도 Shell Command를 잘 수행할 수 있는? RunSCommand 함수추가(taglist에서 뱃김);
MS Windows에서 파일확장자등록을 한번에하는 JobsInMSW 함수 추가··· *.tl(내 Vim에서 ctags파일들을 한 프로젝트단위로 관리하는 파일)도 함께;
Vim 구동시 초기화하는 부분에 taglist를 열게 해 놓음;
어쨋든 VimScript에 익숙해져서 더 세련되고 완벽한 코딩;
목차;
자잘한거 수정하고 beta라고 써있는 부분 삭제 :q ;
내가 배포하는 minibufexpl.vim 여러가지 모드에서 클릭해도 동작하게 해놓음-- 원본에는 노멀모드에서만 동작됨.kickcursor()사용해서 아무 윈도에 커서있을 때 클릭해도 좋게 해놓음. 디버그관련 코드 주석처리해버림.Ctrl+Shift+Tab 맵핑을 Ctrl+Alt+Tab으로 변경
내가 적절히 수정한 plugins={taglist.vim, minibufexpl.vim} Vim배포판내장스크립={netrw.vim, netrwSettings.vim} 함께 배포
}
p.s. 저의 vimrc나 미숙한 영어에 대한 조언들을 해주세요.
"version 0.9.2.4
"TODO:minibufexpl_dewr.vim--middlemouse, dwFirst=winbufnr(0)?WTF?
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This is spawned by dewr
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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 for other key. 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" 이 두 파일안에서 을 다른 키로 변경하시기를 바랍니다. 은 다른 기능을 위해 사용됩니다.
" --하지만 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
"Other configurations
"Initialization and Splash!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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" ] "Buffer type, leftmost one is the buftype you dont want to close most. 가장 왼쪽에 있는 type이 당신이 가장 닫지 않기를 원하는 buftype입니다.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" plugins installed = { taglist, dewrs_minibufexplorer, supertab }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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 = "" "use omni-completion
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" jobs in MS Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function JobsInMSW()
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')
endfunction
" 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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" out of Vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" "$VIM/vimfiles/plugins/taglist.vim" 의 도움말 단축키가인데 ?로 고치는걸 추천합니다. 은 다른 기능을 위해 사용됩니다.
" in "$VIM/vimfiles/plugins/taglist.vim" change for ?. 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
"
" 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! ' . '' . s:clickmap"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" graphical user interface
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if ( has("gui_running") )
winsize 190 55
if ( has("win32") && !has("win32unix") )
set gfn=NanumGothicCoding:h10:b:cHANGEUL
endif
endif
" My favorite colorscheme
colorscheme desert
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" simple contents of _vimrc are little different from default contents of _vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
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.'
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.
" 절대 지우지 마세요. 버퍼들을 휘발성이지 않게 만드는 겁니다.
" 리스트에 있는 버퍼들을 모두 훑어보면서 저장할지말지 물어봅니다.
" Sweeping buffers in the list and asks you whether to save or not
function Sweeping()
call KickCursor()
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."
return 7
else
execute "bwipeout! ".IsTheFileLoaded("")
endif
else
w
endif
elseif ( l:choice == 2 )
"echo "didn't save it."
else
"echo "canceled."
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
else
execute "bwipeout! ".IsTheFileLoaded("")
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
" 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
" 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\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
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 단축키 설정 Hotkeys
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 상용구 설정 AutoText
iab xdate=strftime("%y-%m-%d %h:%m:%s")
iab xtime=strftime("%h:%m:%s")
" 파일 열기 --browse 지원이 없을 때 netrw browser를 사용하게 해놓았습니다.
" Open a file --browse 지원이 없을 때 netrw browser를 사용하게 해놓았습니다.
map :call KickCursor():call LetsLoad()
map!
" ^_^* "map! " windows?(Ctrl+Q):(Ctrl+V) (Ctrl+C) "" 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 for other key. will be used for other function.
" --만약 당신의 Vim 이 browse feature를 지원하지 않는다면 파일열기를 위한 브라우징은 "netrw"를 통해서 이루어질 것입니다. "$VIM/vim72/autoload/netrw.vim" and "$VIM/vim72/autoload/netrwSettings.vim" 이 두 파일안에서 을 다른 키로 변경하시기를 바랍니다. 은 다른 기능을 위해 사용됩니다.
" loads an empty noname-buffer
" 비어있는 이름없음-버퍼를 불러옵니다.
map :call KickCursor():enew!
map!
" buffer(not 탭) 닫기
" discards a buffer
map :call KickCursor():call QuitBuffer()
map!
" Alt+ quit Vim
" Alt+ Vim 종료
map :call QuitVim()
map!
" Alt+Q close a window
" Alt+Q 창 닫기
map :q!
map!
" 이전버퍼 show previous buffer
map :call KickCursor():bprevious!
map!
" 다음버퍼 show next buffer
map :call KickCursor():bnext!
map!
map :call KickCursor():bnext!
map!
" 컴파일 설정 --이건 듀르가 넣은거 아니라 뭔지 잘···
"map :!gcc % -o %<
" 저장 & taglist update
" Save & taglist update
map :call KickCursor():w:TlistUpdate:call TagFileRequest(@%)
map!
" Ctrl+ 다른이름으로 저장 & taglist update
" Ctrl+ Save as new name & taglist update
map :call KickCursor():call SaveAsNewName():UMiniBufExplorer:TlistUpdate
map!
" 태그 앞으로. 택뒤로= 도움말볼때 유용합니다.
" Ctrl+G Jump to newer entry in the tag stack. It is useful when you are reading help text
map :tag
" Ctrl+S CTRL-Z(윈도우에서만 인가?)로 undo한것을 취소하겠습니다. ※※※※※
" Ctrl+S redo. cancels undo(maybe Ctrl+Z). ※※※※※
map
map!
" minibufexplorer toggle key
map :TMiniBufExplorer
map!
" ctrl+f10 taglist toggle
map :TlistToggle
map!
" Ctrl+ to toggle the menu bar
" Ctrl+ 메뉴바 토글
map :if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif
map!
" Ctrl+F1 help window··· oops Vim does not support cp949 help-text
"map :help dewrs.txt
"map!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 기타 설정 other configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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
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 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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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()
_vimrc <-Click this to download it.
Dewrs_minibufexpl.vim <-Click this to download it.
taglist.vim <-Click this to download it.
netrw.vim_and_netrwSettings.vim.7z <-Click this to download it.
Dewrs_minibufexpl.vim <-Click this to download it.
taglist.vim <-Click this to download it.
netrw.vim_and_netrwSettings.vim.7z <-Click this to download it.
0.9.2.5 예고 = {
***치명적버그 수정(noname buffer에서 저장안함을 눌렀을때 다른 noname buffer를 닫아버릴수있음!)***
Alt+Q가 그냥 윈도우만 닫는거였는데 버퍼를 꺼버리게 변경. (한번누르면 버퍼를 지워버리고(버퍼리스트에 있고 modifiable속성이 있으면 지우지 않음) 노네임버퍼로 놓고 노네임버퍼면서 저장할사항 없으면 윈도우 제거)
Alt+F3으로 종료할 때 버퍼리스트에 있는 버퍼를 표시하고있는 창이 하나도 없었을때 무한루프에 빠지는 현상 수정.
!~파일 오픈시 맨 아랫줄이 [두글자이하].Dewr_C:.[한글자이상]로 시작한다면 ( ex>"Dewr_C:echo "hello" || //Dewr_C:let b:dewr_notagleader=1 ) 그 위의 Dewr_C들중 제일 위의 Dewr_C:명령어"부터 차례대로 명령어 처리한다.
f8이 write명령 쓰던거 update명령으로 교체(update와 달리 write는 변경사항이 없어도 씀)
!~F8 눌렀을때 b:dewr_notagleader != 0 일 경우 tag-leader 관련 작업을 수행하지 않고 파일변경사항update+TagList플러긴에 TlistUpdate만 함.(TIP※File 맨 아랫줄에 //Dewr_C:let b:dewr_notagleader = 1 해 놓으면 그 파일 열때마다 :dewr_notagleader=1 이 생기겠죠!)
Dewrs_mswin.vim 배포 mswin에서 내가 안 쓰는 부분을 주석처리해버림.
추천플러긴에서 supertab 제거.
맵리더를 comma(,)로 설정··· 기본값은 \입니다.
편리한 단축키들을 더 보강;
Dewrs_minibufexpl.vim 에서 마우스중간버튼(휠) 클릭시 버퍼닫기; C-TAB과 Ctrl+Alt+TAB이 삽입수정모드에서도 커서워프를 수행함
}
0.9.2.3f 에서 변경된 점 = {
Sweeping 함수가 현재버퍼부터 검사하지 않고 바로 앞 버퍼부터 검사하는 걸 고쳤음.
당신이 보았던 버퍼들은 창에서 사라져도 내용이 보존됩니다. 버퍼리스트에서 없어지면 날라가지만···.;
Alt+Q 창닫기; Alt+F3에서 KickCursor함수를 쓸데없이 호출하는 걸 삭제;
omni-completion을 위한 tags를 생성하는 도구들(TagLeader File(*.tl)이 한 프로젝트에 연관된디렉토리경로들을 갖고있고 해당 디렉토리에 있는 코드파일은 자동으로 해당 TagLeader가 가르키는 ctags파일에 tags가덧붙여진다;
kickcursor함수가 ppbNeverClose멤버인 버퍼만 열려있을 때 호출됬을 경우 무한루프발생하는걸 처치;
supertab 추가(안깔아도 상관없지만 추천!);
내가 만든 함수 splitfname을 버리고 내장함수들을 사용···그리고 기타 내장스크립트기능을 적극활용하고 내가 만든 긴 코드 삭제;
KickCursor함수가 같은버퍼가 여러창에 띄어져 있을 때 더러운 기분을 줄 수 있는걸 고침;
Win32환경이 아닌 다른 환경에서도 Shell Command를 잘 수행할 수 있는? RunSCommand 함수추가(taglist에서 뱃김);
MS Windows에서 파일확장자등록을 한번에하는 JobsInMSW 함수 추가··· *.tl(내 Vim에서 ctags파일들을 한 프로젝트단위로 관리하는 파일)도 함께;
Vim 구동시 초기화하는 부분에 taglist를 열게 해 놓음;
어쨋든 VimScript에 익숙해져서 더 세련되고 완벽한 코딩;
목차;
자잘한거 수정하고 beta라고 써있는 부분 삭제 :q ;
내가 배포하는 minibufexpl.vim 여러가지 모드에서 클릭해도 동작하게 해놓음-- 원본에는 노멀모드에서만 동작됨.kickcursor()사용해서 아무 윈도에 커서있을 때 클릭해도 좋게 해놓음. 디버그관련 코드 주석처리해버림.Ctrl+Shift+Tab 맵핑을 Ctrl+Alt+Tab으로 변경
내가 적절히 수정한 plugins={taglist.vim, minibufexpl.vim} Vim배포판내장스크립={netrw.vim, netrwSettings.vim} 함께 배포
}
p.s. 저의 vimrc나 미숙한 영어에 대한 조언들을 해주세요.
"version 0.9.2.4
"TODO:minibufexpl_dewr.vim--middlemouse, dwFirst=winbufnr(0)?WTF?
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This is spawned by dewr
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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
" --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" 이 두 파일안에서
" --하지만 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
"Other configurations
"Initialization and Splash!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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" ] "Buffer type, leftmost one is the buftype you dont want to close most. 가장 왼쪽에 있는 type이 당신이 가장 닫지 않기를 원하는 buftype입니다.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" plugins installed = { taglist, dewrs_minibufexplorer, supertab }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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 = "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" jobs in MS Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function JobsInMSW()
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')
endfunction
" 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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" out of Vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" "$VIM/vimfiles/plugins/taglist.vim" 의 도움말 단축키가
" in "$VIM/vimfiles/plugins/taglist.vim" change
"
" $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
"
" 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!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" graphical user interface
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if ( has("gui_running") )
winsize 190 55
if ( has("win32") && !has("win32unix") )
set gfn=NanumGothicCoding:h10:b:cHANGEUL
endif
endif
" My favorite colorscheme
colorscheme desert
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" simple contents of _vimrc are little different from default contents of _vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
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.'
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.
" 절대 지우지 마세요. 버퍼들을 휘발성이지 않게 만드는 겁니다.
" 리스트에 있는 버퍼들을 모두 훑어보면서 저장할지말지 물어봅니다.
" Sweeping buffers in the list and asks you whether to save or not
function Sweeping()
call KickCursor()
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."
return 7
else
execute "bwipeout! ".IsTheFileLoaded("")
endif
else
w
endif
elseif ( l:choice == 2 )
"echo "didn't save it."
else
"echo "canceled."
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
else
execute "bwipeout! ".IsTheFileLoaded("")
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
" 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
" 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\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
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 단축키 설정 Hotkeys
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 상용구 설정 AutoText
iab xdate
iab xtime
"
"
map
map!
" ^_^* "map!
" --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
" --만약 당신의 Vim 이 browse feature를 지원하지 않는다면 파일열기를 위한 브라우징은 "netrw"를 통해서 이루어질 것입니다. "$VIM/vim72/autoload/netrw.vim" and "$VIM/vim72/autoload/netrwSettings.vim" 이 두 파일안에서
" loads an empty noname-buffer
" 비어있는 이름없음-버퍼를 불러옵니다.
map
map!
"
"
map
map!
" Alt+
" Alt+
map
map!
" Alt+Q close a window
" Alt+Q 창 닫기
map
map!
"
map
map!
"
map
map!
map
map!
"
"map
"
"
map
map!
" Ctrl+
" Ctrl+
map
map!
"
" Ctrl+G Jump to newer entry in the tag stack. It is useful when you are reading help text
map
" Ctrl+S CTRL-Z(윈도우에서만 인가?)로 undo한것을 취소하겠습니다. ※※※※※
" Ctrl+S redo. cancels undo(maybe Ctrl+Z). ※※※※※
map
map!
"
map
map!
" ctrl+f10 taglist toggle
map
map!
" Ctrl+
" Ctrl+
map
map!
" Ctrl+F1 help window··· oops Vim does not support cp949 help-text
"map
"map!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 기타 설정 other configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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
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
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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()
Dewrs_minibufexpl.vim <-Click this to download it.
taglist.vim <-Click this to download it.
netrw.vim_and_netrwSettings.vim.7z <-Click this to download it.
# by | 2009/02/27 16:07 | IT자료 | 트랙백 | 덧글(0)







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