"" Maintainer:	hyun <fasthyun@magicn.com>
""
"===== vim note !! ========================= 
" 1.File Extention
"  %<,#< no extention
"  ex) gcc % -o %:t:r  <CR>:copen 5<CR><C-W>W 
"   

"colorscheme hyun 
"colorscheme pyte 
"colorscheme ironman
"colorscheme greenia 
colorscheme fruity

set guicursor=n-c-v:block-Cursor-blinkwait400-blinkoff500-blinkon600,i:ver25-Cursor-blinkwait400-blinkon450-blinkoff450


syntax on
set guifont=Courier\ 10\ pitch\ 10
"set guifont=Andale\ Mono\ 10 
set guifont=Monaco\ 9
"set guifont=Courier\ 9
"set guifontwide=Gulim
"set encoding=euc-kr

set number
set nowrap
set whichwrap=<,>,h,l,[,]
set lines=43 columns=100
set autoindent		" always set autoindenting on
set smartindent
set showtabline=1

"behave mswin
"set compatible
"set nocompatible


"Description : function calling
"noremap <silent><C-F11> :cal VimCommanderToggle()<CR>

"set noexpandtab
"set softtabstop=4
"set hardtabs=4
set tabstop=4
set shiftwidth=4 "for v-block indent !! one_movement in tabs !!
set tags=tags
"set mouse=a
set backupdir=~/.vim/
"set nowrap
"set fileformat=unix,dos
"let g:explVertical=1<CR>:let g:explHideFiles='~$,obj$,o$'<CR>:Explore<CR> 



"set printheader=%<%f%h%m%=Page\ %N
"set printoptions=left:5pc,header:1
"set printfont=Baekmuk-Batang
"set printencoding=euc-kr
"set printexpr=PrintFile(v:fname_in)

function! PrintFile(fname)
  call system("gtklp " . a:fname)
  call delete(a:fname)
  return v:shell_error
endfunc


"let Tmenu_sort_type = "name" 
"let Tmenu_max_submenu_items = 25
"let Tmenu_max_tag_length = 10 

map		<2-LeftMouse>	<C-]>
imap	<2-LeftMouse>	<C-]>
imap	<C-]>		<ESC><C-]>i
imap	<C-t>		<ESC><C-t>i

map 	<F1> 		:help quickref<CR> 
map 	<F3> 		:Explore<CR> 
map 	<C-F3> 		:split .<CR>
"map 	<F2> 		:w<CR>:silent !sync<CR>
map 	<F2> 		:w<CR>
map		<F4>   		:Tlist<CR>
map 	<F5>  		:BufExplorer<CR>
map		<F6>		i(by fasthyun@magicn.com)<ESC>
map 	<F8>		<F2>:make -j 2 run<CR><CR>
"map 	<F5>  		:bnext<CR>
map 	<F9>  		<F2>:!gcc % -o %:t:r <CR>:copen 8<CR><C-W>W

map 	<F11> 		:q<CR>
map 	<F12> 		:split ~/.vimrc<CR>
"noremap <silent><C-F11> :cal VimCommanderToggle()<CR>
"map 	<F7>  		<F2>:make<CR>:!ctags -R <CR>:copen 8<CR><C-W>W
map 	<F7>  		<F2>:make<CR>:copen 8<CR><C-W>W


imap 	<F1>		<ESC><F1>i
imap 	<F2>  		<ESC><F2>i
imap 	<F3>  		<ESC><F3>i
imap 	<F4>  		<ESC><F4>i
"imap 	<F5>  		<ESC>:bnext<CR>i
imap 	<F5>  		<ESC><F5>i
imap 	<F6>  		<ESC><F6>i
imap 	<F7>  		<ESC><F7>i
imap 	<F8>  		<ESC><F8>i
imap 	<F9>  		<ESC><F9>i
imap	<F10> 	 	<ESC><F10>i
imap 	<F11>  		<ESC><F11>i
imap	<F12>  		<ESC><F12>i


"???
map 	<C-O> 		:!<CR>

"MS notepad key binding by hyun 
"map 	<C-y> 		v<End><C-x>
"map 	<C-y> 		v<End><C-x>
"imap 	<C-y> 		<ESC><C-y>i

"vmap 	<C-x>  		"+x
"vmap 	<C-c>  		"+y
"imap 	<S-Down>  	<ESC>v<Down>
"vmap 	<S-Down>  	<Down>
"imap 	<S-UP>  	<ESC>v<UP>
"vmap 	<S-UP>  	<UP>

"imap 	<C-`>  		<ESC>``i
"imap 	<A-a>  		<ESC>`ai
"imap 	<S-Right>  	<ESC>v
"vmap 	<S-Down>  	<Down>
map 	<TAB>  		i<TAB>
map 	<C-F12> 	<ESC>:e ~/.vim/after/syntax/c.vim<CR>

augroup	hyuns 
	"remove all autcmd  of hyun
	autocmd!   
	
"	autocmd VimEnter * tab all
"	autocmd BufAdd * exe 'tablast | tabe "' . expand( "<afile") .'"'

    autocmd 	BufWritePost  	.vimrc     	source   ~/.vimrc
   "    autocmd 	BufReadPre   	*.*plot   	set 	makeprg=gnuplot\ -persist\ %
"    autocmd 	BufReadPre   	*.*plot   	map 	<F7>  :!gnuplot -persist <CR>
    autocmd 	BufReadPre   	*.*plot   	set 	makeprg=gnuplot\ -persist\ %;display\ output.eps
"   autocmd 	BufReadPre    	*.*plot     	map 	<F8>  <F2>:display\ output.eps <CR>
    autocmd 	BufReadPre   	*.java   	set 	makeprg=javac\ %
    autocmd 	BufReadPre   	*.java   	map	<F8> 	:!java %< <CR>
    autocmd 	BufReadPre   	*.v   		set 	makeprg=vlog\ %
    autocmd 	BufReadPre   	*.vhd*		set 	makeprg=vcom\ -nologo\ -work\ work\ %
    autocmd 	BufReadPre   	*.py		set 	makeprg=python\ %
    autocmd 	FileType		* 			highlight Cursor guifg=black guibg=green 
   " autocmd 	ColorScheme		* 			highlight Cursor guifg=green guibg=black 
"highlight iCursor guifg=green guibg=steelblue
    "autocmd 	BufReadPre   	*.py		set 	efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m  
"    autocmd 	BufReadPre    *.vhd    	 map 	<F7>	:!vcom -nologo  %t<CR><CR>
"    autocmd 	FileReadPre   	*.c     	 map 	<F8>	<F2>:make run<CR><CR>
augroup end



amenu &Make.Edit\ Makefile<Tab>none		:e Makefile<CR>
amenu &Make.Make<Tab>F7			    	:make <CR> 
amenu &Make.Run<Tab>F8			    	<F8>
amenu &Make.Rebuild\ All    			:make clean;make -R<CR><CR>
amenu &Make.Clean<Tab>none		    	:make clean<CR><CR>

amenu Hyun.Edit\ \ \ \"vimrc\"<TAB>F12    		<F12><CR>
amenu Hyun.Altenative\ header<TAB>:A   		:A<CR>
amenu Hyun.TagList\ Toggle 	    		:Tlist<CR>
amenu Hyun.Delete\ DOS\ return\ ^M 		:%s/\r//g<CR>
amenu Hyun.Remove\ Empty\ Line			:g/^$/d<CR>
"amenu Hyun.Print				:hardcopy >~/print.ps\|!gtklp ~/print.ps<CR>:
amenu Hyun.Make\ PDF				:hardcopy >~/print.ps\|!ps2pdf ~/print.ps ~/print.pdf<CR> 
amenu Hyun.Make\ PDF\(VisualRegion\)<TAB>:	:'<,'>hardcopy >~/print.ps\|!ps2pdf ~/print.ps ~/print.pdf<CR> 
amenu Hyun.img2c\ TGA<Tab>none		    	:!img2c *.tga<CR>



"
", Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
"set shiftwidth=4
set fillchars=vert:\ 
"set backupext=.bak
let g:explDetailedHelp=0

" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

"let &guioptions = substitute(&guioptions, "t", "", "g")
"set guioptions-=T
"set guioptions-=t
" Don't use Ex mode, use Q for formatting
"map Q gq

" Make p in Visual mode replace the selected text with the "" register.
"vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc>

" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.


"call Hyuntest()
if exists("Hyuntest")
	delfunction Hyuntest
endif


function! Hyuntest()
	let s=1
endfunction


"vcom errorformat
"set 	efm+=\*\*\ Error:\ %f\(%l\)%m
"set 	efm+=\*\*\ Warning:\ [%.]\ %f\(%l\)%m

"function: VHDL comment by hyun 
"help vmap
"vmap  	-		<C-V>I--<ESC>
"vmap	_		:s/--//<CR>:noh<ESC>


