|
楼主 |
发表于 2015-10-6 04:47:32
|
显示全部楼层
colo murphy
"$ defaults write org.vim.MacVim MMNativeFullScreen 0
syntax enable
syntax on
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8
set directory=.,$TEMP
set nobackup
set diffexpr=MyDiff()
set guicursor=a:block-blinkon0
set nu
set guifont=Ubuntu\ Mono:h16
set guifontwide=TakaoGothic:h16
set showmatch
set nocompatible
set bs=2
set background=dark
set tabstop=2
set wrapmargin=2
set nobk
set cindent
set shiftwidth=2
set ruler
set noexpandtab
set smartindent " 智能自动缩进
set autoindent
set shortmess=atI
set wrap "自动折行
set encoding=utf-8
set ambiwidth=double
set guioptions-=L " 隐藏左侧滚动条
set guioptions-=r " 隐藏右侧滚动条
set guioptions-=b " 隐藏底部滚动条
"set showtabline=0 " 隐藏Tab栏
set guioptions-=m
set guioptions-=T
"映射<F2>为文件另存为
imap <F2> <ESC>:saveas
nmap <F2> :saveas
"映射<F3>为当前词条查询
imap <F3> <ESC><Plug>EblookInput
nmap <F3> <Plug>EblookInput
"映射<F4>开启eblook单词查询
imap <F4> <ESC><Plug>EblookSearch
nmap <F4> <Plug>EblookSearch
"映射<F5>为保存更新文件
imap <F5> <ESC>:w<CR>
nmap <F5> :w<CR>
"映射<F7>打开、关闭文件目录表
nmap <F7> :NERDTreeToggle<CR>
imap <F7> <ESC>:NERDTreeToggle<CR>
"映射<F8>排版Json原数据
nmap <F8> :%!python -m json.tool<CR>
imap <F8> <ESC>:%!python -m json.tool<CR>
"映射<F9>打开、关闭命令控制台
nmap <F9> :ConqueTerm bash<CR>
imap <F9> <ESC>ZZ<CR>
"映射<F10>打开、关闭可选菜单
map <silent> <F10> :if &guioptions =~# 'T' <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <Bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
"映射<F12>重载语法高亮文件
noremap <F12> <Esc>:syntax sync fromstart<CR>
inoremap <F12> <C-o>:syntax sync fromstart<CR>
" ######### 括号、引号、中括号等自动匹配 ######### "
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
":inoremap < <><ESC>i
":inoremap > <c-r>=ClosePair('>')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
:inoremap ` ``<ESC>i
let s:pattern = '^\(.* \)\([1-9][0-9]*\)$'
let s:minfontsize = 9
let s:maxfontsize = 13
function! AdjustFontSize(amount)
if has("gui_gtk2") && has("gui_running")
let fontname = substitute(&guifont, s:pattern, '\1', '')
let cursize = substitute(&guifont, s:pattern, '\2', '')
let newsize = cursize + a:amount
if (newsize >= s:minfontsize) && (newsize <= s:maxfontsize)
let newfont = fontname . newsize
let &guifont = newfont
endif
else
echoerr "You need to run the GTK2 version of Vim to use this function."
endif
endfunction
function! LargerFont()
call AdjustFontSize(1)
endfunction
command! LargerFont call LargerFont()
function! SmallerFont()
call AdjustFontSize(-1)
endfunction
command! SmallerFont call SmallerFont()
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
"映射ctrl up/ctrl down改变字体大小
nnoremap <C-Up> :silent! let &guifont = substitute(
\ &guifont,
\ ':h\zs\d\+',
\ '\=eval(submatch(0)+1)',
\ '')<CR>
nnoremap <C-Down> :silent! let &guifont = substitute(
\ &guifont,
\ ':h\zs\d\+',
\ '\=eval(submatch(0)-1)',
\ '')<CR>
if has("gui_running")
" GUI is running or is about to start.
" Maximize gvim window.
set lines=35 columns=90
else
" This is console Vim.
if exists("+lines")
set lines=40
endif
if exists("+columns")
set columns=100
endif
endif
" ######### save and run ######### "
" compile c file
func! CompileGcc()
exec "w"
let compilecmd="!gcc -Wall -pedantic -std=c99 "
let compileflag="-o %<"
exec compilecmd." % ".compileflag
endfunc
" compile cpp file
func! CompileCpp()
exec "w"
let compilecmd="!g++ -Wall -pedantic -std=c++98 "
let compileflag="-o %<"
exec compilecmd." % ".compileflag
endfunc
" compile java file
func! CompileJava()
exec "w"
exec "!javac %"
endfunc
" compile Haskell file
func! CompileHaskell()
exec "w"
let compilecmd="!ghc --make "
let compileflag="-o %<"
exec compilecmd." % ".compileflag
endfunc
" run Lua file
func! RunLua()
exec "w"
exec "!lua %"
endfunc
" run Perl file
func! RunPerl()
exec "w"
exec "!perl %"
endfunc
" run Python file
func! RunPython()
exec "w"
exec "!python %"
endfunc
" run Ruby file
func! RunRuby()
exec "w"
exec "!ruby %"
endfunc
" auto-select relevant script to run according to file type
func! CompileCode()
exec "w"
if &filetype == "c"
exec "call CompileGcc()"
elseif &filetype == "cpp"
exec "call CompileCpp()"
elseif &filetype == "java"
exec "call CompileJava()"
elseif &filetype == "haskell"
exec "call CompileHaskell()"
elseif &filetype == "lua"
exec "call RunLua()"
elseif &filetype == "perl"
exec "call RunPerl()"
elseif &filetype == "python"
exec "call RunPython()"
elseif &filetype == "ruby"
exec "call RunRuby()"
endif
endfunc
" run compiled/script files
func! RunResult()
exec "w"
if &filetype == "c"
"exec "call CompileGcc()"
exec "! %<"
elseif &filetype == "cpp"
"exec "call CompileCpp()"
exec "! %<"
elseif &filetype == "java"
"exec "call CompileJava()"
exec "!java %<"
elseif &filetype == "haskell"
"exec "call CompileHaskell()"
exec "! %<"
elseif &filetype == "lua"
exec "!lua %<.lua"
elseif &filetype == "perl"
exec "!perl %<.pl"
elseif &filetype == "python"
exec "!python %<.py"
elseif &filetype == "ruby"
exec "!ruby %<.rb"
endif
endfunc
" Ctrl + S save and compile
map :call CompileCode()<CR>
imap <ESC>:call CompileCode()<CR>
vmap <ESC>:call CompileCode()<CR>
" Ctrl + R save and run
map :call RunResult()<CR>
imap <ESC>:call RunResult()<CR>
vmap <ESC>:call RunResult()<CR>
let mapleader=","
nmap <leader>f :Fullscreen<CR>
"使用space向下翻页
nmap <space> <c-f>
"使用backspace向上翻页
nmap <backspace> <c-b>
"使用>号切换到前一个Nerdtree的分页
nmap < gT<CR>
"使用>号切换到后一个Nerdtree的分页
nmap > gt<CR>
"使用“,tb”键就可以打开/关闭tagbar窗口:
map <silent> <leader>tb :TagbarToggle<cr>
"使用“,nt”键就可以打开/关闭nerdtree窗口:
map <silent> <leader>nt :NERDTreeToggle<cr>
"按,ev打开配置文件
nmap <silent> <leader>ev :e $MYVIMRC<CR>
"按,sv重载配置文件
nmap <silent> <leader>sv :so $MYVIMRC<CR>
"按,m取消高亮搜索结果
nmap <silent> <leader>m :nohlsearch<CR>
"按,w保存文件
nmap <leader>w :w<CR>
"按,e在新tab打开文件
nmap <leader>e :tabe<Space>
"按,r在当前tab打开文件
nmap <leader>r :e<Space>
"按,cmd在新tab打开控制台
nmap <leader>cmd :ConqueTermSplit cmd.exe<CR>
nmap <leader>ccmd :ConqueTerm cmd.exe<CR>
"设置tagbar
"let g:tagbar_ctags_bin='D:\ctags58\ctags.exe'
"
"uncomment following to enable autoopen tagbar
"autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.rb,*.py call tagbar#autoopen()
"生成一个tags文件
"nmap <F9> <Esc>:!ctags -R *<CR>
"let g:indent_guides_guide_size=1
"配置Snipmate
let g:acp_behaviorSnipmateLength=1
let g:ConqueTerm_CloseOnEnd = 1
let g:ConqueTerm_ToggleKey = '<F13>'
"配置eblook
let eblookenc='cp932'
let g:ConqueTerm_StartMessages = 0
let eblook_contentwin_height=15
let eblook_dictlist1 = [
\{
\'book': 'Downloads/UbuntuDict/SRD',
\'name': 'srd',
\'title': 'ランダムハウス英語辞典',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/EIDAI6',
\'name': 'eidai6',
\'title': '研究社新英和大辞典第6版',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/PLUS',
\'name': 'plus',
\'title': '研究社リーダーズ+プラスv2',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/COLLOC',
\'name': 'colloc',
\'title': '研究社 新編英和活用大辞典',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/GENIUS',
\'name': 'genius',
\'title': 'ジーニアス英和和英辞典',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/EIJIRO',
\'name': 'eijiro',
\'title': '英辞郎108',
\'skip': 0,
\},
\]
let eblook_dictlist2 = [
\{
\'book': 'Downloads/UbuntuDict/LDOCE4',
\'name': 'ldoce4',
\'title': '朗文当代高级英英辞典',
\'skip': 0,
\},
\]
let eblook_dictlist3 = [
\{
\'book': 'Downloads/UbuntuDict/CAMBRIEC',
\'name': 'cambriec',
\'title': '剣橋高級学習者辞典(第三版)',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/OXfull',
\'name': 'oxfull',
\'title': '牛津双解英漢',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/AHD',
\'name': 'ahd',
\'title': '美国伝統辞典(双解)',
\'skip': 0,
\},
\]
let eblook_dictlist4 = [
\{
\'book': 'Downloads/UbuntuDict/SGK2',
\'name': 'sgk2',
\'title': '小学館中日日中统合辞典',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/DAIJIRIN',
\'name': 'daijirin',
\'title': '三省堂スーパー大辞林',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/KOJIEN',
\'name': 'kojien',
\'title': '広辞苑第六版',
\'skip': 0,
\},
\{
\'book': 'Downloads/UbuntuDict/KOUDANJC',
\'name': 'koudanjc',
\'title': '講談社日中',
\'skip': 0,
\},
\]
|
|