Customizations

Here we give examples of customizing command shells and editors which is quite useful for speeding up your workflow by using command keyboard shortcuts

To experiment with our Bash and Emacs customizations start by downloading

custom.tar

and saving it into your home directory (~/), followed by running this command for unpacking the archive (use the left mouse button to copy the commands into your clipboard and the middle mouse button to paste the text into a terminal window):

  cd
  tar xpof custom.tar
  cd customization

Bash Customization

The command shell we use in this course is "bash". Like others, it can be customized in various ways

To install our bash customizations run

  ./install-bashrc

(as a general rule you shouldn't trusted any code given to you. In this case, you can look at the script file to see what it does using cat install-bashrc. There you'll see that it saves the previous ~/.bashrc file before overwriting it.

The bashrc file is loaded whenever a the shell is launched. Use less ~/.bashrc to learn what shortcuts our customization provides.

To adjust your shell settings, edit ~/.bashrcand after saving the file, run

  source ~/.bashrc
to instruct the shell to read the updated settings

The editor and command shell is where you spend most of the time programming in CMPUT 350 labs. So it's a good idea to learn how to use those tools effectively

Emacs Customization (Optional)

In CMPUT 350 you can use whatever text editor you like. But we encourage you to use one which allows you to compile C++ programs and lets you jump to compile errors with a stroke of a key to considerably speed up programming

In this section we show you how to customize Emacs can be customized by changing its resource file ~/.emacs, which is read whenever Emacs is run

Our customizations include tabbed editing and keyboard shortcuts for compiling and jumping to code lines and compile error locations (see emacs.txt for a list of common commands)

To install our emacs customizations run

  ./install-emacs

This scripts overwrites ~/.emacs after copying it, and also copies a LISP file into ~/.emacs.d that enables tabbed editing

Now that the new Emacs files are in place, when you run Emacs, you will have some handy features, such as a column display (useful for determining the length of a line) and syntax highlighting (e.g. comments are a different color than if statements), and tabbed editing. Although using Emacs is recommended, you are not required to use this .emacs file, and are definitely encouraged to delve into the mysterious corners of GNU .emacs customization and modify things as you see fit

To get started have a look at ~/.emacs (for instance with less ~/.emacs) and be amazed ;-)

Happy customizations!