zoukankan      html  css  js  c++  java
  • VIM配置文件

    PS:F7编译  F9运行  F8调用GDB  F12形成初始文件头(C++)(都在NORMAL模式下)

    Ctrl+A 全选加复制(NORMAL模式下)

    Ctrl+Z 自动缩进(NORMAL模式下)

    编译选项加了 -std=c++11 -O2

    set nocompatible
    source $VIMRUNTIME/vimrc_example.vim
    source $VIMRUNTIME/mswin.vim
    behave mswin
    
    set diffexpr=MyDiff()
    function MyDiff()
      let opt = '-a --binary '
      if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
      if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
      let arg1 = v:fname_in
      if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
      let arg2 = v:fname_new
      if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
      let arg3 = v:fname_out
      if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
      let eq = ''
      if $VIMRUNTIME =~ ' '
        if &sh =~ '<cmd'
          let cmd = '""' . $VIMRUNTIME . 'diff"'
          let eq = '"'
        else
          let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . 'diff"'
        endif
      else
        let cmd = $VIMRUNTIME . 'diff'
      endif
      silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
    endfunction
    
    syntax on
    set nu
    
    set nobackup
    set noswapfile
    set cindent
    set mouse=a
    set tabstop=8
    set shiftwidth=8
    set background=dark
    colorscheme evening
    
    set guifont=courier_new:h10
    
    map <C-A> ggVG"+y
    map <C-Z> gg=G
    
    map <F7> :call Cmp()<CR>
    func! Cmp()
    exec "w"
    exec "!g++ -O2 -std=c++11 % -o %<"
    endfunc
    
    map <F8> :call Rungdb()<CR>
    func! Rungdb()
        exec "w"
        exec "!g++ -Wall -O2 -std=c++11 % -g -o %<"
        exec "!gdb ./%<"
    endfunc
    
    map <F9> :call Run()<CR>
    func! Run()
    exec "!%<"
    endfunc
    
    map <F12> :call SetTitle()<CR>
    func SetTitle()
    let l = 0
    let l = l + 1 | call setline(l,'#include <bits/stdc++.h>')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'using namespace std;')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'#define rep(i, a, b)	for (int i(a); i <= (b); ++i)')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'int main(){')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'	return 0;')
    let l = l + 1 | call setline(l,'}')
    let l = l + 1 | call setline(l,'')
    let l = l + 1 | call setline(l,'')
    endfunc
  • 相关阅读:
    js画线
    开源Math.NET基础数学类库使用(11)C#计算相关系数
    Cent OS5.2安装Hyper-V集成光盘
    解决oracle11g的ORA-12505问题
    Oracle11g安装出现em.ear
    Entity Framework Code First (八)迁移 Migrations
    Modernizr.js入门指南(HTML5&CSS3浏览器兼容插件)
    Waves:类Material Design 的圆形波浪(涟漪)点击特效插件
    多种css3时尚侧栏菜单展开显示效果Off-Canvas Menu Effects
    iOS 复选框风格转换 Switchery 开关效果
  • 原文地址:https://www.cnblogs.com/cxhscst2/p/6675412.html
Copyright © 2011-2022 走看看