Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I really hope someone on this subject can help me.

I recently enrolled for a programming course and one subject requires me to program in c/c++ on Linux os. I've had previous c++ experience on the .net framework building console apps and winforms.

The problem is this course wants us not to use any IDE of any sort, the only thing we allowed to use is the terminal and something called 'vi commands'. How can get started with?

share|improve this question
1  
I would dare to say that if the course isn't to learn vi/vim he shouldn't care over what platform I develop. –  Braiam Feb 13 at 19:16
    
How does the professor know that you aren't using an IDE? Do you have live lessons where you are required to code? Is the exam done on a computer? –  Bakuriu Feb 13 at 21:17
    
vi should be on most systems already, it's a standard part of Unix. One of the advantages of knowing vi is that it's pretty much guaranteed to be on any Unix-like system, even things like Busybox. –  david25272 Feb 14 at 3:51
1  

5 Answers 5

vi is super frustrating if you don't know your way around it. You get a sea of little tildes and you're supposed to know what to do? Eesh.

I recommend at least installing gvim so you have a help menu. It isn't an IDE so you aren't cheating on your class. Do apt-get install gvim -- gvim has menus for when you can't remember how the heck you're supposed to open a dang file or save one. The keyboard shortcuts are all listed on the menus, so you can start to learn.

The really basic things that you need to know to avoid going insane:

  • i puts you in edit mode so you can type
  • esc takes you out of the edit mode
  • :w saves your file
  • :q quits the editor
  • :q! quits an unsaved file

Other resources: this looks like a great getting started tutorial: http://www.openvim.com/tutorial.html as does the WikiBooks edition of Learning the vi editor

share|improve this answer

I suggest you install vim. From the terminal Ctrl+Alt+t:

sudo apt-get install vim

Several dependencies will also be installed. Then start a new project, again from the terminal:

vim new_project.c

Learn more about vim:

man vim
share|improve this answer

First: install vim. Otherwise you're in for a world of pain. Second: you should try looking for something called a 'cheat sheet'. They're useful documents which contain mostly commands and a small explanation. Some examples:

Not all those commands will be useful to you, but nothing stops you from creating your own cheat sheet

share|improve this answer

After installing vim running

vimtutor

from the commandline you'll get "a 30 minute tutorial that teaches the most basic Vim functionality hands-on" as it calls itself.

share|improve this answer

If you want to become a vim ninja in a fun way, try this: http://vim-adventures.com/. You learn all the basic vim functionality by playing a fun little game.

And as an extra: if you prefer moving around with the arrow keys instead of the letters and you want backspace to behave as in nano (at least I do), you can add the following in your ~/.vimrc file (if you do not have one, just create it):

set nocompatible "must be first line 
set backspace=indent,eol,start 
share|improve this answer
    
Note that only the first three levels of VIM Adventures are free. To learn more than some basics (the keys hjkl, bew, x, and B) from the game, it costs $25. Though it might be helpful to learn those basics using the game and then continue to a different tutorial (like vimtutor) when the game shows the paywall. –  Rory O'Kane Mar 30 at 21:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.