zoukankan      html  css  js  c++  java
  • 我的vimrc

    set nocompatible
    set number
    filetype off
    set history=1000
    colorscheme jellybeans
    syntax on
    set autoindent
    "set smartindent
    set tabstop=4
    set shiftwidth=4
    set showmatch
    set noexpandtab
    set guioptions-=T
    set backspace=2
    set ruler
    set incsearch
    set nobackup
    set nowrap
    set viminfo='1000
    set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
    set lines=35 columns=100
    "以上设置部分
    
    set rtp+=$HOME.vimundleVundle.vim
    call vundle#begin()
    Plugin 'VundleVim/Vundle.vim'
    Plugin 'godlygeek/tabular'
    Plugin 'plasticboy/vim-markdown'
    Plugin 'joker1007/vim-markdown-quote-syntax'
    Plugin 'iamcco/markdown-preview.vim'
    call vundle#end()
    filetype plugin indent on
    " 以上vundle
    let g:vim_markdown_folding_disabled = 1
    set conceallevel=2
    let g:vim_markdown_math = 1
    nmap <silent> <F9> <Plug>MarkdownPreview
    nmap <silent> <F10> <Plug>MarkdownPreviewStop
    
    map <F9> :call Compile()<CR>
    map <F10> :call Run()<CR>
    map <F5> :call RunGdb()<CR>
    func! Compile()
    	if &filetype == 'cpp'
    		exec "!g++ % -o %< -m32 -Wall -Wl,--stack=102400000 -fdiagnostics-color=always"
    		exec "redraw!"  
    	endif
    endfunc
    func! Run()
    	if &filetype == 'cpp'
    		exec "!%<"
    		exec "redraw!"  
    	endif
    endfunc
    func! RunGdb()
    	:call Compile()
    	exec "!gdb32 %<"
    	exec "redraw!"  
    endfunc
    "以上运行&调试
    
    inoremap ( ()<LEFT>
    inoremap [ []<LEFT>
    inoremap { {}<LEFT>
    "以上自动补全
    
    map <S-u> <C-r>
    "把U设为重做
    map <C-s> <Esc>:w<cr>
    "更熟悉的保存方法
    noremap x "_x
    noremap X "_dd
    "让x和X成为真正的删除字符/删除一行
    noremap s "_s
    noremap S "_S
    "让s和S成为真正的删除+插入字符/一行
    
    func! Remdc(char)
    	if getline('.')[col('.') - 1] == a:char
    		return "<Right>"
    	else
    		return a:char
    	end if
    endfunc
    func! Remdc2(char)
    	if getline('.')[col('.') - 1] == a:char
    		return "<Right>"
    	else
    		return a:char . a:char . "<Left>"
    	endif
    endfunc
    inoremap ) <c-r>=Remdc(')')<CR>
    inoremap ] <c-r>=Remdc(']')<CR>
    inoremap } <c-r>=Remdc('}')<CR>
    inoremap ' <c-r>=Remdc2("'")<CR>
    inoremap " <c-r>=Remdc2('"')<CR>
    "以上避免重复括号,同时处理了引号的自动补全
    
    func! Autonl()
    	if getline('.')[col('.') - 2] == '{' && getline('.')[col('.') - 1] == '}'
    		return "<CR><CR><UP><TAB>"
    	elseif getline('.')[col('.') - 2] == ')'
    		return "<CR><TAB>"
    	else
    		return "<CR>"
    	endif
    endfunc
    inoremap <CR> <c-r>=Autonl()<CR>
    inoremap <S-CR> <c-r>=Autonl()<CR>
    "以上自动换行
    
    func! Rempr()
    	if getline('.')[col('.') - 2] == '{' && getline('.')[col('.') - 1] == '}'
    		return "<Right><BS><BS>"
    	elseif getline('.')[col('.') - 2] == '(' && getline('.')[col('.') - 1] == ')'
    		return "<Right><BS><BS>"
    	elseif getline('.')[col('.') - 2] == '[' && getline('.')[col('.') - 1] == ']'
    		return "<Right><BS><BS>"
    	elseif getline('.')[col('.') - 2] == '"' && getline('.')[col('.') - 1] == '"'
    		return "<Right><BS><BS>"
    	elseif getline('.')[col('.') - 2] == "'" && getline('.')[col('.') - 1] == "'"
    		return "<Right><BS><BS>"
    	else
    		return "<BS>"
    	endif
    endfunc
    inoremap <BS> <c-r>=Rempr()<CR>
    "以上自动删除匹配
    
    

    /plasticboy/vim-markdown:

    • zR:打开所有标题

    • zM:折叠所有标题

    • zA:打开当前标题

    • zC:折叠当前标题

  • 相关阅读:
    科学使用睡眠周期,你会比别人拥有更多时间
    遇见那个对的人,便是爱情
    因为专注,所以伟大
    从来都没有爱情发生的人生
    每天只要做好三件事就行了 积跬步以至千里
    不读书的中国人
    两性思维的差异与情侣夫妻间争吵
    结婚的意义 — 几米
    二维码工具类
    验证码图片生成工具类——Captcha.java
  • 原文地址:https://www.cnblogs.com/MyNameIsPc/p/9638581.html
Copyright © 2011-2022 走看看