乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      vim:一鍵編譯單個(gè)源文件

       herowuking 2014-04-10
       具體功能如下:
      1.按F5編譯單個(gè)文件,支持C,C++,C#,也可以支持java。
      2.獲取編譯器錯(cuò)誤描述,在錯(cuò)誤描述上回車(chē),可以直接跳轉(zhuǎn)到錯(cuò)誤行。
      總之一句話(huà),懶人的第一選擇。

      準(zhǔn)備工作:
      1.安裝Vi/Vim/gVim,Windows、Linux環(huán)境皆可。
      2.gcc、g++編譯器。針對(duì)這一點(diǎn),Linux用戶(hù)一般比較清楚,用命令which gcc一查就知道是不是有g(shù)cc了。但是對(duì)于windows用戶(hù),首先要安裝gcc編譯器,有幾個(gè)辦法,(1)安裝minGW,然后把minGW安裝目錄下的bin目錄放到系統(tǒng)path里。(2)安裝Dev-C++,然后把Dev-C++安裝目錄下的bin目錄放到系統(tǒng)path里,(3)安裝cygwin,并保證安裝了gcc、g++(默認(rèn)都沒(méi)有安裝,需要選擇安裝),然后把cygwin安裝目錄下的bin目錄放到系統(tǒng)path里。以上三個(gè)方法都可以,可以任意選擇,cygwin安裝大概有點(diǎn)困難,不過(guò)也是學(xué)習(xí)的過(guò)程。

      好了,代碼列在下面,需要把下面的代碼復(fù)制到vim的配置文件(Windows下:_vimrc,Linux下:.vimrc)。保存以后,用vim打開(kāi)一個(gè)C/C++程序,然后F5進(jìn)行編譯、差錯(cuò)。
      "單個(gè)文件編譯
      if(has("win32") || has("win95") || has("win64") || has("win16"))
      let g:iswindows=1
      else
      let g:iswindows=0
      endif
      "單個(gè)文件編譯
      map <F5> :call Do_OneFileMake()<CR>
      function Do_OneFileMake()
      if expand("%:p:h")!=getcwd()
      echohl WarningMsg | echo "Fail to make! This file is not in the current dir! Press <F7> to redirect to the dir of this file." | echohl None
      return
      endif
      let sourcefileename=expand("%:t")
      if (sourcefileename=="" || (&filetype!="cpp" && &filetype!="c"))
      echohl WarningMsg | echo "Fail to make! Please select the right file!" | echohl None
      return
      endif
      let deletedspacefilename=substitute(sourcefileename,' ','','g')
      if strlen(deletedspacefilename)!=strlen(sourcefileename)
      echohl WarningMsg | echo "Fail to make! Please delete the spaces in the filename!" | echohl None
      return
      endif
      if &filetype=="c"
      if g:iswindows==1
      set makeprg=gcc\ -o\ %<.exe\ %
      else
      set makeprg=gcc\ -o\ %<\ %
      endif
      elseif &filetype=="cpp"
      if g:iswindows==1
      set makeprg=g++\ -o\ %<.exe\ %
      else
      set makeprg=g++\ -o\ %<\ %
      endif
      "elseif &filetype=="cs"
      "set makeprg=csc\ \/nologo\ \/out:%<.exe\ %
      endif
      if(g:iswindows==1)
      let outfilename=substitute(sourcefileename,'\(\.[^.]*\)$','.exe','g')
      let toexename=outfilename
      else
      let outfilename=substitute(sourcefileename,'\(\.[^.]*\)$','','g')
      let toexename=outfilename
      endif

      if filereadable(outfilename)
      if(g:iswindows==1)
      let outdeletedsuccess=delete(getcwd()."\\".outfilename)
      else
      let outdeletedsuccess=delete("./".outfilename)
      endif
      if(outdeletedsuccess!=0)
      set makeprg=make
      echohl WarningMsg | echo "Fail to make! I cannot delete the ".outfilename | echohl None
      return
      endif
      endif
      execute "silent make"
      set makeprg=make

      execute "normal :"
      if filereadable(outfilename)
      if(g:iswindows==1)
      execute "!".toexename
      else
      execute "!./".toexename
      endif
      endif
      execute "copen"

      endfunction

      "進(jìn)行make的設(shè)置
      map <F6> :call Do_make()<CR>
      map <c-F6> :silent make clean<CR>
      function Do_make()
      set makeprg=make
      execute "silent make"
      execute "copen"
      endfunction

      以上直接參考至Vimer,感謝Dantezhu 

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀(guān)點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶(hù) 評(píng)論公約

        類(lèi)似文章 更多