Vim code completion - c++

Is it possible to make Vim complete the code for you, like in any other IDE (not just word searching, but members of classes, methods etc.)?
What are the best options / plugins available?

Clang Complete lets you use Clang for accurate auto-completion of C and C++

I believe that following this list of links you will be able to leave any IDE and become a faithful user of vim, see some plugins that help you with IDE resources...
snipMate plugin faster code complete skels
video showing snipmate on vimeo
article about sparkup html codding to understand this resource
video showing sparkup html complete to see this in action
Auto complete popup plugin here
Advanced undo resource
some interesting videos on advanced usage of vim on vimeo
more free videos at vimcasts.org
amazing article about vim in this link
vim for php programmers (useful not only for php programmers) here

This is a little out dated. A rising star in Vim code completion is the "YouCompleteMe" plugin. Check it out here.

Omni completion is definitely the way to go. Instantiate it in insert mode with Ctrl+X Ctrl+O.
I use it in conjunction with SuperTab as well to allow for tab completion similar to bash shell.

Don't use it myself but I have heard of Omni complete:
http://vim.wikia.com/wiki/Omni_completion
The Vim Wiki contains a couple of things that may be of use for auto completion of words.

You can try this out Dictionary completions, get dictionary for you language. Simple ways
if you are programming in c++, there are ctag and cscope and with OmniCppComplete plugin.
Hope it will help

It's possible, but most people don't.
vim is a fairly generic editor, that said, it does contain some "code completion" features such as word completion, etcetera, but nothing like the likes of, say, Delphi's IDE.
Such a system could be added by scripting vim - vim can directly run several scripting languages that make this easy, or you could send the file through an external script.

Related

Minimum Profit Editor Autocomplete

because of the fact that I am working a lot via SSH I am using an text editor named Minimum Profit (link) its a terminal editor similar to vim, nano or emacs but it uses a lot of modern shortcuts like ctrl-s to save etc.
I am also programming a lot in c++ via terminal.
I have seen some ways so make emacs or vim enable autocomplete for some programming languages such as c++, perl, python etc.
Examples: 1. Emacs, 2. Vim
Heres my question:
Does anyone know a way to achieve this goal in the terminal version of the Minimum Profit Editor?
Other then changing its source code of course.
I am looking for plugins, scripts or fancy configurations to get it working.
My main goal it to have a c++ code completion for commands and object members.
(A linter would also be nice.)
Alternative if there is no easy way, I would also agree to use a similar editor as long as it features all the benefits of Minimum Profit, such as "normal" keyboard-shortcuts, mouse usage, being able to open multiple files at once, selection, copy/paste, git and build support, find and replace and syntax highlighting.
And no switching to emacs or vim is no option.

Emacs tutorial for large projects

can someone be kind enough to direct me to emacs tutorials for large C++ project using gdb as debugger, the project does contain make file.
I did search for emacs tutorials but some are too advanced for beginners and some only target one single file tutorial. I did read the previous posts too but did not find an answer suitable for large projects. Also I am not used to using 'git', one of the answers in previous posts.
Actually, learning Emacs is a thing that just can't be easy. You'll have to learn the basics before you will be able to read "advanced" tutorials.
The first thing you should do is to work through the builtin tutorial (C-h t). It's really good.
Then you should try to familiarize yourself with Emacs configuration basics. The easy way suggested by many users is to get a ready-for-use configuration (such as Emacs Starter Kit) and try to understand it and then tailor to your own needs and preferences. The advantages of using a ready-made configuration kit are:
It's a working code useful for learning the basics of Elisp. This learning path is way faster than reading Elisp manuals and gathering configuration code one small piece at a time.
It demonstrates a lot of useful Emacs features which otherwise might require you long time (sometimes years) to discover.
It offers a framework which you can base on writing your own configuration.
Still you should undoubtedly get rid of whatever parts of configuration you don't need.
Then (or along with the previous step) read some tutorial about using Emacs as a development platform. You can easily find a lot of tutorials via "emacs for [c] development" queries to Google. Here is one of many.
Then install Cedet (Alex Ott has written a great tutorial about it) and start feeling the power.
After that you'll know what to do next.
By the way, there is a great collection of Emacs resources maintained by Bozhidar Batsov.
Start simple. Launch Emacs without any customisations and start editing your source files. The only "tutorial" you'll need to do basic editing is the inbuilt one you'll get by hitting Control H followed by t (Referred to as C-h t in Emacs speak).
Compiling can be done by typing M-x (Alt x) compile and hitting enter. It will prompt you for the compile command which is by default make. Change it to whatever suits you.
Running gdb is done using M-x gdb and hitting enter. The interface is similar to the M-x make.
Don't use things like the Emacs starter kit which makes assumptions on your behalf. While useful as a starting point for newbies, it suppresses curiosity and that's the key to learning Emacs. The above things should be enough for you to start. Once you hit problems and are not satisfied with the ways of doing things, you can search for resources and things. Emacs is not an "IDE" and so you won't have the tight integration which many custom editors have. Don't expect it.

emacs feature similar to netbeans templates?

In netbeans you can store some code as template and call it back whenever you like by typing a specific word and TAB..is there a similar emacs feature, and if yes how can I use it?
thanks in advance!
There are a couple of libraries that come with emacs that provide this kind of functionality. SkeletonMode and TempoMode both allow you to insert templates into your code. They can be combined with AbbrevMode to automatically trigger on keywords, like in NetBeans.
Yasnippet is a much more full-featured library to do the same, bundled with lots of defaults for various languages. It is not currently bundled with emacs.
Yes, take a look here : http://code.google.com/p/yasnippet
In addition, you can watch this video : http://www.youtube.com/watch?v=76Ygeg9miao
I used to use ELSE Mode very heavily when I was doing a lot of programming by voice.

Spell checker for comments, strings, maybe more

I am looking for a spell checker for c++ source code. Unfortunately all I can find is Visual Studio specific. I would like something which works on Linux.
Edit:
Ultimately I want to automate it in some way. I am not very proficient in spell checking, but what I am thinking of is a not-interactive console tool which prints error messages, or something like that.
Personally I use vim, but not everyone on the project does of course.
Currently we are using svn so it is possible to integrate it into the pre-commit-hook maybe?
Don't you guys do something similar?
Eclipse (Java based so will do mac, linux etc.) has spellcheckers built in. With the CDT plugin you can edit and build C++ code.
Vim also supports spell checking.
See the other question for more.
Emacs too has spell checking, flyspell-prog-mode, is the one I use, it is a (very!) personal preference which one works best for you.
The automating the spell check idea is a much trickier one. The best you can hope for is one that will tell you if there are spelling errors. That's trickier than it sounds, especially with code comments which may have all sorts of valid abbreviations which are not real words.
Having a company policy that whatever people have their EDITOR environment variable set to has a spell check enabled, should cut down on the spelling errors in commit messages, for example.
I found something!
svn co svn://anonsvn.kde.org/home/kde/trunk/quality/krazy2 krazy2
this is part of the quality management of KDE.
Besides a multitude of checks (KDE-specific, qt-specific, cpp-specific, ...) there is automated spell checking.
hope this helps
Which editors do you use? Many of them have spell checking abilities. E.g., gedit just needs to have the spellcheck plugin enabled.
You can check out some alpha code I just whipped up for a similar purpose: pyspellcode. It's Zlib licensed and uses clang and hunspell.
No idea how pyspellcode compares to what KDE does/provides but am happy to receive comparisons and will prioritize its development more if there's interest it.
At just over 200 lines, I'm guessing pyspellcode is at least lighter weight than KDE's solution though KDE's solution I imagine is way more tested.

What is the right tool/skill set for writing a script/program to consistently log on and check for updates?

If this is possible...
What would you have to use/learn in order to write something to consistently check (every 20 minutes) whether a page has been updated? It would involve logging into the system and navigating the site. As an example I'd wished I'd had in the past, a script to log onto my school's website and check for updated grades.
Thanks to all suggestions :)
will it involve things such as changing window focus, mouse movement, etc?
If so, take a look at autoit
I personally would use Perl. But, I'd imagine there are a number of scripting languages that can accomplish this.
This sounds like you want to knock together something quick and dirty, use what you know, most languages have a library for this. You don't need to learn something new!
Or, if you are just interested in getting notified when the page has changed, you could use some existing service, such as:
Watch That Page
Consider Selenium, specifically the Selenium IDE for Firefox; it's generally used for testing, but it lets you record and replay scripts in your browser -- and then edit them as HTML and JavaScript. You can just insert a test that stops the script once the grades differ from their "expected" values.
Skill set required:
HTML
Firefox Addons
JavaScript (and the DOM)
Selenium
This is basically a shell script based solution for a Unix or Windows with Cygwin system.
To fetch the page of interest,
wget -N <URI>
Do this once from the command line and get the file.
Open the file in some editor and check for your pattern of interest.
You can then use grep, sed, awk, or even perl to filter out things of interest.
You could then write this all into a shell script and either loop it with a sleep or plug it into a cron job.
You would basically need to learn some sed, awk, grep for this. But, that should be quick for the purpose at hand and what you learn would be usable in future for other such needs. You could also dive into perl or python -- but i will not suggest a start from scratch on that for what you need here.