ACM中的vim配置

來源:互聯網
上載者:User

標籤:


把vim當主力編輯器搞acm很長一段時間了,用vim的好處不必多說,

在此總結一下ACM中的vim配置方法,配置直接寫到 ~/.vimrc 中就可以了.  



比賽用的14行配置:

syntax onset cindentset nuset tabstop=4set shiftwidth=4set background=darkmap <C-A> ggVG"+ymap <F5> :call Run()<CR>func! Run()exec "w"exec "!g++ -Wall % -o %<"exec "!./%<"endfunc


日常用的配置  :

主要多了運行java,一鍵補全標頭檔,字型什麼的

syntax onset cindentset mouse=aset tabstop=4set shiftwidth=4set nuset nocompatibleset showmodeset showcmdset ignorecase smartcaseset hlsearchset autoindentset smarttabset smartindent"colorscheme solarizedset background=darkset gfn=Source\ Code\ Pro\ 14map <F5> :call Run()<CR>func! Run()    exec "w"if &filetype is 'cpp'|| &filetype is 'c' || &filetype is 'cc'    exec "!clang++ -Wall % -o %<"    exec "!./%<"elseif &filetype is 'java'exec "!javac\ -d\ .\ %"exec "!java\ %<"endifendfuncmap <C-A> ggVG"+ymap <F12> :call SetTitle()<CR>func SetTitle()let l = 0let l = l + 1 | call setline(l,'/* ***********************************************')let l = l + 1 | call setline(l,'Author        :CKboss')let l = l + 1 | call setline(l,'Created Time  :'.strftime('%c'))let l = l + 1 | call setline(l,'File Name     :'.expand('%'))let l = l + 1 | call setline(l,'************************************************ */')let l = l + 1 | call setline(l,'')let l = l + 1 | call setline(l,'#include <iostream>')let l = l + 1 | call setline(l,'#include <cstdio>')let l = l + 1 | call setline(l,'#include <cstring>')let l = l + 1 | call setline(l,'#include <algorithm>')let l = l + 1 | call setline(l,'#include <string>')let l = l + 1 | call setline(l,'#include <cmath>')let l = l + 1 | call setline(l,'#include <cstdlib>')let l = l + 1 | call setline(l,'#include <vector>')let l = l + 1 | call setline(l,'#include <queue>')let l = l + 1 | call setline(l,'#include <set>')let l = l + 1 | call setline(l,'#include <map>')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,'int main()')let l = l + 1 | call setline(l,'{')let l = l + 1 | call setline(l,'//freopen("in.txt","r",stdin);')let l = l + 1 | call setline(l,'//freopen("out.txt","w",stdout);')let l = l + 1 | call setline(l,'    ')let l = l + 1 | call setline(l,'    return 0;')let l = l + 1 | call setline(l,'}')endfunc


linux系統中用vim寫acm代碼的說明:

 (注:在終端中使用以獲得最佳效果)

1.開啟終端 mkdir 建立檔案夾 , touch 建立檔案

2. vim xxx.cpp 然後寫代碼就可以了

3. 寫好了以後直接按<F5>,會自動跳回終端編譯並運行,Ctrl-C中斷運行並跳回vim

4. 調試好了以後 <Ctrl-A> 複製代碼到粘貼板,提交



Kuangbin大神的配置:http://www.kuangbin.net/archives/vim-acmicpc

ACM中的vim配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.