捯饬加摸索 搞了个自以为不错的配色方案
点击这里下载solarized.vim 主题
然后把solarized.vim放在/usr/share/vim/vim73/colors下即可
然后把从上边链接下载的文件,放到~/.vim/bundle下,没有可以新建(具体原因我也不清楚,里边有一个readme.md文件,大家可以自行参阅)
.vimrc配置文件,下边是代码复制文件保存到~/.vimrc中即可(没有可以自己新建)
功能
1.生成文件可以附带用户名,邮箱,创建时间,默认的几行代码
2.F5可以直接编译调试
–我是分割线———————————————————————
syntax on
set number
let g:solarized_italic=0
set background=dark
let g:solarized_termcolors=256
let g:solarized_degrade = 1
let g:solarized_bold = 0
let g:solarized_underline = 0
let g:solarized_italic = 0
let g:solarized_contrast = "high"
let g:solarized_visibility= "high"
colorscheme solarized
set autoindent
set cindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smartindent
set showmatch
set matchtime=5
set foldenable
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
set completeopt=longest,menu
"自动添加前缀
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
function! SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: xiao333ma")
call append(line(".")+2, "\# mail: xiao3333ma@gmail.com")
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\#########################################################################")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: xiao333ma")
call append(line(".")+2, " > Mail: xiao3333ma@gmail.com ")
call append(line(".")+3, " > Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if &filetype == 'cpp'
call append(line(".")+6, "#include<iostream>")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+6, "#include<stdio.h>")
call append(line(".")+7, "#include<stdlib.h>")
call append(line(".")+8, "#include<math.h>")
call append(line(".")+9, "#include<string.h>")
call append(line(".")+10, "int main(int argc,const char *argv[])")
call append(line(".")+11, "{")
call append(line(".")+12, " ")
call append(line(".")+13, "")
call append(line(".")+14, "")
call append(line(".")+15, "")
call append(line(".")+16, " return 0;")
call append(line(".")+17, "}")
call cursor(14,0)
endif
endfunction
map <F5> :call Rungdb()<CR>
func! Rungdb()
exec "w"
exec "! echo will gcc %"
exec "! gcc % -o %<"
exec "! echo gcc complete and will run"
exec "! ./%<"
endfunc