For simplicity and multi-platform compatibility we have been asking you to use "nano" when editing files or code in terminal. As you have probably noticed this is not a great editor and, of course, there are many better options. Here are some editors we like (note: when coding in python spaces and indentation is important, because this is how the interpreter deliminates logical statements, so you need to make sure that when you press tab this is seen as some number of spaces; otherwise, you will end up with a mess of python indentation errors for yourself and everyone you collaborate with):
Open Preferences, under the Sublime Text 2 tab, and select settings-default. This should open up a bunch of code in your Sublime editor window. Search for 'translatetabstospaces' and change the 'false' to 'true,' then search for 'tabsize' and make sure that is set to 4. Save and that's it. You can see some details about these setting here.
MacVim on which page you see download options, so choose the one appropriate for your mac. Note: this is more powerful editor but you should be familiar with its basic use; you don't actually need to download MacVim and can just use Vim which is you can invoke in terminal (type: vim or vim filename), but the standalone editor is nice.... To edit settings for vim/MacVim
- open ~/.vimrc (you can do this by typing: vim ~/.vimrc in terminal)
- paste in set tabstop=4 set shiftwidth=4 set expandtab
- GEdit download the latest version. Then go to Preferences, click on the editor tab and check the boxes "Insert spaces instead of tabs" and "Enable automatic indentation;" also, set the tab width to 4.
vim is very powerful but has a steep learning curve. You can install it with:
sudo apt-get install vim-gnome
Then modify your
.vimrc as shown in the MacVim instructions.
blog comments powered by Disqus