VIM的配置文件VIMRC

现在的编程语言IDE动不动就上G,如果只是熟悉语法规则还是VIM好用

贴一下vimrc的配置 在用户目录下

编辑或者新建.vimrc

新建目录 .vim

拉取Vundle plugin

https://github.com/VundleVim/Vundle.vim

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

 

编辑 .vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'

Plugin 'tpope/vim-fugitive'
"Plugin 'L9'
"Plugin 'ascenator/L9', {'name': 'newL9'}
Plugin 'Valloric/YouCompleteMe'
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

"文件目录插件
let g:winManagerWindowLayout = "FileExplorer"
set backspace=2
autocmd VimEnter * NERDTree
map <C-n> :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
set number

"""""""""""
"Quickly Run 一键执行脚本 对应不同的文件类型 执行不同的脚本
"""""""""""
filetype on
map <C-R> :call ComplieRunGcc()<CR>
func! ComplieRunGcc()
	exec "w"
	"exec "!clear"
	if &filetype == 'python'
		exec "!time python3 %"
	elseif &filetype == 'py'
		exec "!time python3 %"
	elseif &filetype == 'lua'
		exec "!time lua %"
	elseif &filetype == 'php'
		exec "!time php %"
	elseif &filetype == 'c'
		exec "!g++ % -o %<"
		exec "!time ./%<"
	elseif &filetype == 'cpp'
		exec "!g++ % -o %<"
		exec "!time ./%<"
	elseif &filetype == 'java'
		exec "!javac %"
		exec "!time java %<"
	elseif &filetype == 'sh'
		:!time bash %
	elseif &filetype == 'go'
		"exec "!go build %<"
		exec "!time go run %"
	elseif &filetype == 'html'
		exec "!chrome % &"
	elseif &filetype == 'mkd'
		exec "!~/.vim/markdown.pl % > %.html &"
		exec "!chrome %.html &"
	endif
endfunc
"map <C-T> :w<cr>:!python %<cr>
"map <C-P> :w<cr>:!php %<cr>
"代码自动补全
"autocmd filetype php set omnifunc=phpcomplete
syntax on
colorscheme desert
set guifont=Courier_new:h14:b:cDEFAULT
set fileencodings=ucs-bom,utf-8,GB18030,gbk

安装对应的Plugin

打开 vim 运行 :PluginInstall