No syntax highlighting.
No automatic code indention.
Nothing. I might as well be using notepad.
If you are a recent Linux convert, and a programmer, you too may have experienced the exact same thing. The good news is, you can believe the hype, vi is the amazing tool you have heard it is. The bad news is, it doesn't just come that way, and it's not terribly obvious how to get it that way. Hoperfully, however, I can help a little. I'm guessing the first thigns you want are syntax highlighting automatic code indention. These can be added fairly easily (note: I am assuming you are using Ubuntu, these instructions may not work on another distribution). The first issue here that confuses most people is that Ubuntu does not come with the full vi package by defualt, but rather vim-tiny (also note: vi is pretty old school and is generally not used much these days. Instead an updated version called vim is used, but it is often still referred to as vi, and starting vi at the command line will start vim instead). Once you have the package installed you just need to copy the code in an example file that comes with it over into the .vimrc file in your home folder. This will take care of the aforementioned issues. The commands you need to enter are:
sudo apt-get install vim-full
cp /usr/share/vim/vim71/vimrc_example.vim ~/.vimrc
Aftere you do this fire up a shell and try it out. I have tested it so far with C/C++, Java, and Python code and it works great for all three. I hope this helps get you up and running with vi, and I will try to post more fun tips as I come across them.
No comments:
Post a Comment