问题
I have been using Eclipse CDT for a while now, and the fact of the matter is that, coding can be very slow in the IDE (I use it for the debugger). What I mean by this is, that the auto-pop up (content assist) functionality only works when certain characters are input [::,->,.]
. In Indigo, you could configure the IDE such that it would pop no matter what you type, without pressing Ctrl + SPACE. So, is there a way to bring this back in Juno? A step by step guide would be appreciated.
Secondly, is there a way to get tab completion in Eclipse? What I mean by this is, for example, you have a template (snippet) called cout
, and it essentially adds something to the output buffer:
std::cout << ${"Hello, World"} << std::endl;
Thirdly, if the two features above are unavailable in eclipse, and cannot be implemented even by using hacks, is there an IDE that works with MinGW GCC and has the above features (and free).
回答1:
(I don't know how to post a comment - so I'm writing an "answer"...)
We have given up with Juno because of general performance problems. We turned back to Indigo after two frustrating months trying everything possible to improve speed in Juno.
Eclipse is great and I've been using it for many years now, and normally I welcome the upgrades, but Juno was the only one that has ever caused us such big problems.
回答2:
install vrapper for eclipse, and add a .vrapperrc file like this:
set nohlsearch
set incsearch
inoremap #i<tab> #include<space>
inoremap #d<tab> #define<space>
inoremap #u<tab> #undef<space>
inoremap #p<tab> #pragma<space>
inoremap #ii<tab> #include<space><iostream<Esc>a><CR>
inoremap #is<tab> #include<space><string<Esc>a><CR>
inoremap #iv<tab> #include<space><vector<Esc>a><CR>
inoremap #im<tab> #include<space><map<Esc>a><CR>
inoremap #id<tab> #include<space><deque<Esc>a><CR>
inoremap #il<tab> #include<space><list<Esc>a><CR>
inoremap #ia<tab> #include<space><algorithm<Esc>a><CR>
inoremap #ib<tab> #include<space>"base/base.h"<CR>
inoremap )<tab> )<space>{}<Esc>yyp^i~<Esc>$a<CR>
inoremap main<tab> int<space>main(int<space>argc,<space>char**<space>argv)<space>{<CR>
inoremap init<tab> ccflag::init_ccflag(argc,<space>argv);<CR>cclog::init_cclog(*argv);<CR><CR>
inoremap a<tab> std::atomic
inoremap b<tab> std::bind
inoremap e<tab> std::exception
inoremap f<tab> std::function
inoremap s<tab> std::string
inoremap v<tab> std::vector
inoremap m<tab> std::map
inoremap d<tab> std::deque
inoremap vs<tab> std::vector<std::string<Esc>a>
inoremap up<tab> std::unique_ptr
inoremap sp<tab> std::shared_ptr
inoremap sc<tab> static_cast
inoremap D<tab> DISALLOW_COPY_AND_ASSIGN
inoremap E<tab> EXPECT
inoremap C<tab> CHECK
inoremap i<tab> int32
inoremap I<tab> int64
inoremap u<tab> uint32
inoremap U<tab> uint64
inoremap wc<tab> wchar_t
inoremap r<tab> return
inoremap o<tab> operator
inoremap n<tab> namespace<space>
inoremap t<tab> template
inoremap tn<tab> typename
inoremap td<tab> typedef
inoremap p<tab> public:<Esc>$a<CR>
inoremap pri<tab> private:<Esc>$a<CR>
inoremap pro<tab> protected:<Esc>$a<CR>
inoremap con<tab> continue;
inoremap def<tab> default
inoremap del<tab> delete
inoremap ext<tab> extern<space>
inoremap exp<tab> explicit<space>
inoremap mut<tab> mutable<space>
inoremap vir<tab> virtual<space>
inoremap vol<tab> volatile<space>
then you can tab to complete C++ key words. See more here.
来源:https://stackoverflow.com/questions/15567465/tab-completion-and-automatic-content-assit-in-eclipse-juno-cdt