捯飭加摸索 搞了個自以爲不錯的配色方案
點擊這裏下載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: [email protected]")
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: [email protected] ")
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