Re: [分享] ptt code formatter 簡單版

看板C_and_CPP作者 (qqaa)時間11年前 (2014/02/27 05:16), 編輯推噓2(201)
留言3則, 3人參與, 最新討論串2/3 (看更多)
在 ubuntu 上有另一個做法,就是使用 highlight 這個套件: sudo apt-get install highlight cat test.cpp | highlight -Scpp -otmp.out -Oansi 這個時候 tmp.out 就是包涵了 ansi code 的檔案, 可是現在還不能直接複製貼上,因為 ptt 是用 ^U 當 0x18 (esc) 只要把 tmp.out 內的 0x18 都換成 0x15 就可以了, 我的做法是開 gedit ,把 0x18 換成 0x15 ,再複製貼上就可以了: #include <iostream> using namespace std; int main(int argc, char* argv[]) { vector<int> xs({1, 2, 3, 4}); for (auto x : xs) { cout << x << endl; } return 0; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.175.115

02/27 14:29, , 1F
我想這從ptt站方直接提供支援syntax highlight可能比較方便
02/27 14:29, 1F

02/27 15:20, , 2F
好方法
02/27 15:20, 2F

02/27 15:37, , 3F
有windows版!! http://goo.gl/UdzrnW
02/27 15:37, 3F
文章代碼(AID): #1J3ieIxA (C_and_CPP)
文章代碼(AID): #1J3ieIxA (C_and_CPP)