zoukankan      html  css  js  c++  java
  • .vimrc

    color ron     " 设置背景主题  
    set showcmd         " 输入的命令显示出来,看的清楚些  
    autocmd BufNewFile *.cpp exec ":call SetTitle()" 
    func SetTitle() 
        if &filetype == 'cpp'
    	call setline(1,"#include <iostream>")
        call append(line("."), "#include <cstring>")
        call append(line(".")+1, "#include <cstdio>")
        call append(line(".")+2, "#include <algorithm>")
    	call append(line(".")+3, "using namespace std;")
    	call append(line(".")+4, "")
    	call append(line(".")+5, "inline int read(){")
    	call append(line(".")+6, "	int x = 0, w = 1;")
    	call append(line(".")+7, "	char ch = getchar();")
    	call append(line(".")+8, "	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') w = -1;")
    	call append(line(".")+9, "	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';")
    	call append(line(".")+10, "	return x * w;")
    	call append(line(".")+11, "}")
    	call append(line(".")+12, "")
        endif
    endfunc 
    
    "去空行  
    nnoremap <F2> :g/^s*$/d<CR> 
    "C,C++ 按F5编译运行
    map <F5> :call CompileRunGcc()<CR>
    func! CompileRunGcc()
        exec "w"
        if &filetype == 'cpp'
            exec "!g++ % -o %<"
            exec "! ./%<"
        endif
    endfunc
    "C,C++的调试
    map <F8> :call Rungdb()<CR>
    func! Rungdb()
        exec "w"
        exec "!g++ % -g -o %<"
        exec "!gdb ./%<"
    endfunc
    "从不备份  
    set nobackup
    " 自动缩进
    set autoindent
    set cindent
    " Tab键的宽度
    set tabstop=4
    " 统一缩进为4
    set softtabstop=4
    set shiftwidth=4
    " 显示行号
    set number
    " 允许backspace和光标键跨越行边界
    set whichwrap+=<,>,h,l
    " 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
    set mouse=a
    " 高亮显示匹配的括号
    set showmatch
    "自动补全
    :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
    function! ClosePair(char)
        if getline('.')[col('.') - 1] == a:char
            return "<Right>"
        else
            return a:char
        endif
    endfunction
    
  • 相关阅读:
    爬虫基础
    设计BBS
    中间件和auth模块
    git
    分页器与form表单
    cookie与session
    springboot2.x基础教程:@Enable原理
    springboot2.x基础教程:@Scheduled开启定时任务及源码分析
    springboot2.x基础教程:@Async开启异步任务
    springboot2.x基础教程:JRebel实现SpringBoot热部署
  • 原文地址:https://www.cnblogs.com/rui-4825/p/13649945.html
Copyright © 2011-2022 走看看