`
myhongkongzhen
  • 浏览: 95775 次
  • 性别: Icon_minigender_2
  • 来自: 广州
社区版块
存档分类
最新评论

vim配置

 
阅读更多
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
	set fileencodings=utf-8,latin1
endif

 
if(has("win32") || has("win95") || has("win64") || has("win16")) 
	 
	let g:iswindows=1
else
	let g:iswindows=0
endif
autocmd BufEnter * lcd %:p:h

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

if(g:iswindows==1)
	 
	set go= "无菜单、工具栏" 
	colorscheme darkblack 
	cd c:\Users\Wu Zhenzhen\Desktop\

 
	set guifont=Courier_New:h11  
	set gfw=MingLiU:h12

	 
	winpos 0 0
	set lines=42 columns=168 
endif
 
set nocompatible	" Use Vim defaults (much better!)
set bs=indent,eol,start		" allow backspacing over everything in insert mode
"set ai			" always set autoindenting on
"set backup		" keep a backup file
set viminfo='20,\"50	" read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
	augroup redhat
		" In text files, always limit the width of text to 78 characters
		autocmd BufRead *.txt set tw=78
		" When editing a file, always jump to the last cursor position
		autocmd BufReadPost *
					\ if line("'\"") > 0 && line ("'\"") <= line("$") |
					\   exe "normal! g'\"" |
					\ endif
	augroup END
endif

if has("cscope") && filereadable("/usr/bin/cscope")
	set csprg=/usr/bin/cscope
	set csto=0
	set cst
	set nocsverb
	" add any database in current directory
	if filereadable("cscope.out")
		cs add cscope.out
		" else add database pointed to by environment
	elseif $CSCOPE_DB != ""
		cs add $CSCOPE_DB
	endif
	set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
	syntax on
	set hlsearch
endif

if &term=="xterm"
	set t_Co=8
	set t_Sb=[4%dm
	set t_Sf=[3%dm
endif



 
filetype plugin on
filetype indent on
set autoindent
set smartindent
set cindent
set nu
set tabstop=4  
set cursorline               
set nowrap 
set hlsearch  
set shiftwidth=4           
set softtabstop=4        
au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
set incsearch 
"set backspace=indent,eol,start whichwrap+=<,>,[,]  
if(g:iswindows==1)  
	 
	if has('mouse')
		set mouse=a
	endif
	au GUIEnter * simalt ~x
endif 
set cscopequickfix=s-,c-,d-,i-,t-,e-  

map <F12> :call Do_CsTag()<CR>
"查找声明 
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>:copen<CR> 
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR> 
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>:copen<CR> 
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>:copen<CR> 
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>:copen<CR> 
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>:copen<CR> 
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>:copen<CR> 
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>:copen<CR>
function! Do_CsTag()
	let dir = getcwd()
	if filereadable("tags")
		if(g:iswindows==1)
			let tagsdeleted=delete(dir."\\"."tags")
		else
			let tagsdeleted=delete("./"."tags")
		endif
		if(tagsdeleted!=0)
			echohl WarningMsg | echo "Fail to do tags! I cannot delete the tags" | echohl None
			return
		endif
	endif
	if has("cscope")
		silent! execute "cs kill -1"
	endif
	if filereadable("cscope.files")
		if(g:iswindows==1)
			let csfilesdeleted=delete(dir."\\"."cscope.files")
		else
			let csfilesdeleted=delete("./"."cscope.files")
		endif
		if(csfilesdeleted!=0)
			echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.files" | echohl None
			return
		endif
	endif
	if filereadable("cscope.out")
		if(g:iswindows==1)
			let csoutdeleted=delete(dir."\\"."cscope.out")
		else
			let csoutdeleted=delete("./"."cscope.out")
		endif
		if(csoutdeleted!=0)
			echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.out" | echohl None
			return
		endif
	endif
	if(executable('ctags'))
		"silent! execute "!ctags -R --c-types=+p --fields=+S *"
		"silent! execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ."
		silent! execute "!ctags -R "
	endif
	if(executable('cscope') && has("cscope") )
		if(g:iswindows!=1)
			silent! execute "!find . -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.java' -o -name '*.cs' > cscope.files"
		else
			silent! execute "!dir /s/b *.c,*.cpp,*.h,*.java,*.cs >> cscope.files"
		endif
		silent! execute "!cscope -b"
		execute "normal :"
		if filereadable("cscope.out")
			execute "cs add cscope.out"
			echohl WarningMsg | echo "Succ to add cscope!" | echohl None
		endif
	endif
endfunction

 
"map <F3> :silent! Tlist<CR>  
nmap <silent> tl :Tlist<cr>
let Tlist_Ctags_Cmd='ctags'  
let Tlist_Sort_Type = "name"   
let Tlist_Use_Right_Window=1 
let Tlist_Show_One_File=1  
let Tlist_File_Fold_Auto_Close=0  
let Tlist_Exit_OnlyWindow=1 
let Tlist_Process_File_Always=0  
let Tlist_Compact_Format=1 
"let Tlist_Auto_Open=1  
 
"let NERDShutUp=1
let mapleader = "," 
 
map fg : Dox<cr>
let g:DoxygenToolkit_authorName="Wu Zhenzhen"
let g:DoxygenToolkit_briefTag_pre = "Create on : ".strftime("%Y-%m-%d %H:%M:%S")
let g:DoxygenToolkit_maxFunctionProtoLines = 30 
set foldenable  
set foldmethod=syntax  
set foldcolumn=0  
setlocal foldlevel=1 
" set foldclose=all 
let php_folding = 1  
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR> 
 
"let g:miniBufExplMapWindowNavVim = 1   
"let g:miniBufExplMapWindowNavArrows = 1   
"let g:miniBufExplMapCTabSwitchBufs = 1   
"let g:miniBufExplModSelTarget = 1  
"let g:miniBufExplMoreThanOne= 0 
" MiniBufExpl Colors
"hi MBEVisibleActive guifg=#A6DB29 guibg=fg
"hi MBEVisibleChangedActive guifg=#F1266F guibg=fg
"hi MBEVisibleChanged guifg=#F1266F guibg=fg
"hi MBEVisibleNormal guifg=#5DC2D6 guibg=fg
"hi MBEChanged guifg=#CD5907 guibg=fg
"hi MBENormal guifg=#808080 guibg=fg 
let g:bufExplorerSortBy='fullpath'   
let g:bufExplorerSplitOutPathName=0   
let g:bufExplorerUseCurrentWindow=1
let g:bufExplorerReverseSort=1        
let g:bufExplorerShowNoName=1         
let g:bufExplorerShowRelativePath=0   
noremap <silent> <F11> :BufExplorerHorizontalSplit<CR>
"noremap <silent> <F11> :BufExplorerVerticalSplit<CR> 
"au FileType java VimEnter * NERDTree  
autocmd VimEnter *.java,*.c,*.c++,*.cpp NERDTree  
let NERDTreeShowBookmarks=1  
let NERDTreeIgnore=['\.o$', '\~$', '\.a$', '\.bak$', '\.d$', '\.class$', '.svn$', 'target$']
let NERDTreeDirArrows=0 
let NERDTreeChDirMode=2  
let NERDChristmasTree=1  
let NERDTreeCaseSensitiveSort=1  
let NERDTreeShowHidden=0  
let NERDTreeWinSize=50 
nmap <silent> nt :NERDTreeToggle<cr> 
nmap <silent> qf :cclose<CR>
 
"Hide some files
"let g:explHideFiles='^\.,.*\.class$,.*\.swp$,.*\.swo$,\.DS_Store$'
"nmap <silent> <leader>tt :NERDTreeToggle<cr> 
"let g:NERDTree_title="[NERD Tree]"
"let g:winManagerWindowLayout = "TagList|NERDTree"
"function! NERDTree_Start()
"    exec 'NERDTree'
"endfunction
"function! NERDTree_IsValid()
"    return 1
"endfunction 
"nmap <silent> <F8> :if IsWinManagerVisible() <BAR> WMToggle<CR> <BAR> else <BAR> WMToggle<CR>:q<CR> endif <CR><CR>
"nmap <silent> wm :WMToggle<cr>

 
"let g:winManagerWindowLayout = "BufExplorer,FileExplorer|TagList"
"let g:winManagerWindowLayout='FileExplorer|TagList' 
"let g:winManagerWidth = 30 
"let g:bufExplorerMaxHeight=60
 
"nmap <silent> wm :WMToggle<cr>
"nmap <silent> wm :WMToggle<cr>:q<cr>
"nmap wm :WMToggle<cr>
"map <silent> <F2> :WMToggle<cr>
 
"nnoremap <silent> <F3> :Grep<CR>
nnoremap <silent> <F3> :Rgrep<CR> 
filetype plugin indent on
set completeopt=longest,menu
autocmd FileType java set omnifunc=javacomplete#Complete
au FileType java setlocal completefunc=javacomplete#CompleteParamsInfo
setlocal omnifunc=javacomplete#Complete
setlocal completefunc=javacomplete#CompleteParamsInfo

inoremap <buffer> <A-/> <C-X><C-N><C-N>
inoremap <buffer> <C-Space> <C-X><C-O><C-N>

"autocmd Filetype java inoremap <buffer> . .<C-X><C-O><C-P>

"autocmd FileType java inoremap <expr> <CR>  pumvisible()?"\<C-Y>":"<CR>"
"inoremap <expr> <CR>       pumvisible()?"\<C-Y>":"\<CR>"
"inoremap <expr> <C-J>      pumvisible()?"\<PageDown>\<C-N>\<C-P>":"\<C-X><C-O>"
"inoremap <expr> <C-K>      pumvisible()?"\<PageUp>\<C-P>\<C-N>":"\<C-K>"
"inoremap <expr> <C-U>      pumvisible()?"\<C-E>":"\<C-U>"  
"func! Compile_Java_Code()  
"	exec "w"  
"	if &filetype == "java"  
"		exec "!javac -encoding utf-8 %"  
"	endif  
"endfunc  
"func! Run_Java_Code()  
"	if &filetype == "java"  
"		exec "!java -classpath %:h; %:t:r"  
"	endif  
"endfunc  
 
"map <F5> :call Compile_Java_Code()<CR>   
"map <F6> :call Run_Java_Code()<CR>   
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:vimrc_author='Wu Zhenzhen' 
let g:vimrc_email='myhongkongzhen@gmail.com'  
nmap <F4> :AuthorInfoDetect<cr><esc><esc>
"au FileType java,c,cpp,c++ AuthorInfoDetect<cr><esc><esc>
"au FileType java,c,cpp,c++ AuthorInfoDetect
 











 

分享到:
评论

相关推荐

    vim配置文件目录

    本压缩包包含的“vim配置文件目录”是一个个人化的Vim设置集合,它允许你利用Git进行版本控制,方便追踪和管理你的配置更改。 首先,让我们来理解一下Vim配置文件的重要性。Vim的默认配置可能不能满足每个用户的...

    vim 配置 vim 配置

    Vim是一款强大的文本编辑器,其高度可定制性使得用户能够根据个人喜好和需求进行配置。...记住,每个开发者的Vim配置都是独一无二的,根据自己的需求进行调整,才能让Vim成为真正的个人化高效工具。

    Ubuntu vim配置(很简单)

    下载vimconfig.tar.tgz,将文件拷贝到ubuntu, 执行下面命令: tar zxvf vimconfig.tar.tgz cd vimconfig cp .* ~/ -rvf 部分配置情况: "-------------TagList--------------- "设置ctags路径 let Tlist_Ctags_Cmd ...

    强大的vim配置文件(最新整理)

    本文将深入探讨"强大的vim配置文件"中涉及的关键知识点,以帮助你充分利用这款编辑器。 1. **自动补全**:Vim的自动补全功能极大地提高了编程效率。通过配置,可以在输入括号、函数名、变量名等时自动完成,减少了...

    vim配置文件,vim配置文件

    在Linux环境中,Vim配置文件通常位于用户的主目录下的`.vimrc`文件,这是一个初始化脚本,当Vim启动时会读取这个文件以设定各种选项和映射。以下是一些可能包含在`vim-config`中的关键知识点: 1. **颜色方案**:...

    vim配置插件-dierge

    vim配置插件

    vim配置文件

    `vim配置文件`是个人化Vim环境的关键,它允许用户根据自己的需求调整编辑器的行为,提高编程效率。在Vim中,配置文件通常是名为`.vimrc`的文本文件,位于用户的主目录下。 `ctags`和`cscope`是两个非常有用的辅助...

    vim 配置文件 vim 配置文件 vim 配置文件

    vim配置文件 vimrc vim配置文件 vimrc vim配置文件 vimrc

    vim配置C/C++开发环境.zip

    - `.vimrc`是Vim的配置文件,可以在这里定义各种快捷键和设置。`.vimrc配置新.txt`和`.vimrc配置.txt`提供了配置示例。你需要将这些配置添加到自己的`~/.vimrc`文件中,以启用C/C++开发所需的功能。例如,添加以下...

    vim配置文件.rar

    Vim(Vi IMproved)是一款极其强大的文本编辑器,尤其受到程序员和系统管理员的喜爱。它在Linux、Unix、macOS及Windows等操作系统上都...记住,一个好的Vim配置能够极大地提高开发效率,使得Vim成为你得心应手的工具。

    超级好用vim配置

    "超级好用vim配置"是针对Vim进行个性化设置的一种实践,旨在通过调整配置文件(.vimrc)来优化编辑体验,简化日常任务,提高编程速度。 1. **基本操作** - Vim有三种模式:命令模式、插入模式和底线模式。在命令...

    vim配置文档详解

    vim配置文档详解

    vim配置大全(含插件和配置文件)

    `vim_bak`可能是这个备份或归档的配置文件,用于保存和恢复你的vim配置。 关于vim的配置,以下是一些重要的知识点: 1. **基本操作**:学习Vim的基础操作是必要的,包括启动Vim、进入插入模式(Insert mode)和...

    linux下vim配置

    vim配置文件,可以直接使用,ubuntu在/etc/vim/vimrc

    史上最NB的VIM配置文件

    标题提到的“史上最NB的VIM配置文件”显然指的是一个精心优化过的`.vimrc`文件,这是VIM的初始化脚本,用于存储用户的所有自定义设置和映射。 首先,我们来看`.vimrc`文件。这是一个纯文本文件,其中包含了VIM启动...

    linux vim配置以及插件

    linux vim配置以及插件 linux vim配置以及插件

    ubuntu下vim配置

    vim配置的例子 以及说明 可以学习下

Global site tag (gtag.js) - Google Analytics