• 我的.vimrc


    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
    filetype plugin on

    " IMPORTANT: win32 users will need to have 'shellslash' set so that latex
    " can be called correctly.
    set shellslash

    " IMPORTANT: grep will sometimes skip displaying the file name if you
    " search in a singe file. This will confuse Latex-Suite. Set your grep
    " program to always generate a file-name.
    set grepprg=grep\ -nH\ $*

    " OPTIONAL: This enables automatic indentation as you type.
    filetype indent on

    " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
    " 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
    " The following changes the default filetype back to 'tex':
    let g:tex_flavor='latex'

    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    syntax on
    set tabstop=4
    set softtabstop=4
    set shiftwidth=4
    "解决编码问题
    set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp936
    set autoindent
    set cindent
    set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
    set nu
    set cul        "设置cursorline
    colorscheme ron
    set foldcolumn=2
    set hlsearch    "高亮显示搜索结果
    set incsearch    "搜索时自动缩小范围
    set laststatus=2    "always show the status line
    "下面设置自动添加文件头,SetTitle在后面定义
    autocmd BufNewFile *.c,*.cpp exec ":call SetTitle()"    
    set foldmethod=syntax    "折叠方式
    set foldlevel=0 "设置大于几层的才折叠
    "下面设置新建文件后,自动定位到文件的末尾的前一行,在我机器上若是定位到末尾的话space打不开折叠
    autocmd BufNewFile * normal G-1
    "下面是设置Tlist只显示光标所在的文件的tag,文件较多时最好选上,我不选
    "let Tlist_Show_One_File=1
    "下面是设置关闭文件时是否将Tlist关闭
    let Tlist_Exit_OnlyWindow=1
    let g:winManagerWindowLayout='FileExplorer|TagList'
    nmap wm :WMToggle<cr>
    cs add /home/huwenbiao/cscope.out /home/huwenbiao
    :set cscopequickfix=s-,c-,d-,i-,t-,e-
    :set cscopetag
    "下面是cscope的映射
    nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
    nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
    nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
    nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
    nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
    nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
    nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<CR>$<CR>
    nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
    "下面是MiniBufExplorer的配置
    let g:miniBufExplMapWindowNavVim = 1
    let g:miniBufExplMapWindowNavArrows = 1
    "let g:miniBufExplMapCTabSwitchBufs = 1
    "let g:miniBufExplModSelTarget = 1
    "下面设置Grep
    nnoremap <silent> <F3> :Grep<CR>
    "下面设置new-omni-completion,设置好后可以用成员自动补全,但是其他的补全就不能用了
    filetype plugin indent on    "打开文件类型检测
    set completeopt=longest,menu    "关掉智能补全时的预览窗口
    "下面设置SuperTab
    "let g:SuperTabRetainCompletionType=2
    "let g:SuperTabDefaultCompletionType="<C-X><C-O>"
    "下面是编译调试映射
    map <F5> :call CompileRun()<CR>
    map <F6> :call Debug()<CR>
    "下面是函数定义,只处理c文件和cpp文件
    func CompileRun()
    exec "w"
    if &filetype == 'c'
    exec "!gcc % -g -o %<"
    exec "!./%<"
    elseif &filetype == 'cpp'
    exec "!g++ % -g -o %<"
    exec "!./%<"
    endif
    endfunc
    func Debug()
    exec "w"
    if &filetype=='c'
    exec "!gcc % -g -o %<"
    exec "!gdb %<"
    elseif &filetype=='cpp'
    exec "!g++ % -g -o %<"
    exec "!gdb %<"
    endif
    endfunc
    "SetTitle的定义,这里只处理c文件和cpp文件
    func SetTitle()
    call setline(1,"/***************************************************************\\")
    call append(line(".")," *Author:Hu Wenbiao")
    call append(line(".")+1," *Created Time: ".strftime("%c"))
    call append(line(".")+2," *File Name: ".expand("%"))
    call append(line(".")+3," *Description:")
    call append(line(".")+4,"\\***************************************************************/")
    if &filetype == 'c'
    call append(line(".")+5,"//*========================*Head File*========================*\\\\")
    call append(line(".")+6,"")
    call append(line(".")+7,"#include<stdio.h>")
    call append(line(".")+8,"/*----------------------*Global Variable*----------------------*/")
    call append(line(".")+9,"")
    call append(line(".")+10,"//*=======================*Main Program*=======================*//")
    call append(line(".")+11,"")
    call append(line(".")+12,"int main(){")
    call append(line(".")+13,"    return 0;")
    call append(line(".")+14,"}")
    elseif &filetype=='cpp'
    call append(line(".")+5,"//*========================*Head File*========================*\\\\")
    call append(line(".")+6,"")
    call append(line(".")+7,"#include<iostream>")
    call append(line(".")+8,"#include<stdio.h>")
    call append(line(".")+9,"#include<stdlib.h>")
    call append(line(".")+10,"#include<string.h>")
    call append(line(".")+11,"/*----------------------*Global Variable*----------------------*/")
    call append(line(".")+12,"")
    call append(line(".")+13,"//*=======================*Main Program*=======================*//")
    call append(line(".")+14,"using namespace std;")
    call append(line(".")+15,"")
    call append(line(".")+16,"int main(){")
    call append(line(".")+17,"    freopen(\"input\",\"r\",stdin);")
    call append(line(".")+18,"}")
    endif
    endfunc
  • 相关阅读:
    ssh:connect to host xxx port 22: Connection refused---------you don't have permission to acccess the requested location--------remote host identification has changed
    YOLOV3算法笔记
    jQuery元素查找方法
    jquery获取元素方式
    jQuery常用事件
    Jquery常用方法
    JavaScript数组操作
    jQuery中.bind() .live() .delegate() .on()的区别
    CSS初始化代码
    jQuery判断浏览器
  • 原文地址:https://www.cnblogs.com/Open_Source/p/1904947.html
Copyright © 2020-2023  润新知