Setting your default C editor to gvim
When using the Mac-OSX operating system,
it's possible to set a specific application to run whenever a specific
filetype is clicked inside the Finder.
For the first half of this unit,
we'll employ a simple text-based editor to edit our C programs,
and the command-line to compile our programs with gcc.
This page explains how to set gvim
(the graphical interface to the vim editor)
to be your default editor of C files,
whenever C files are clicked inside the Finder.
- Firstly, open the Finder from the Dock, by clicking on the Finder icon:
- Next, navigate within the Finder to the directory containing your C files:
- Now, using the right mouse button (or the right-hand-side of Apple's
Mighty Mouse that's provided in the CSSE labs)
select "Get Info" from the popup menu to
select the application that you want to use to open your C files.
You may need to open the menu's tab entitled "Open with:"
(note that we'll reset the chosen editor to Xcode in the 2nd half of
this unit):
- Select "Other...." from the menu to locate the gvim application:
- The gvim application resides at /Applications/gvim,
so find it and click it with the left mouse button.
Ensure that you also select the checkbox "Always Open With":
- Having selected the gvim application,
click "Change All..." back on the Info menu so that all C programs will
now be similarly opened with the gvim application:
- Confirm that you want to use gvim to edit all C files:
- Now, gvim will commence execution and you may edit your C files.
Now you may commence editing any C file by clicking on it from
within the Finder,
or by typing gvim filename.c at the command line
(in the Terminal).
You may like to set some of gvim's options to make it easier to use.
It's recommended that you use syntax colouring to highlight the
structure of your C programs:
- You may also like gvim to display line numbers of the files
it's editing. This will help you to find any lines that gcc
identifies as having an error.
Note that the line numbers are not actually saved in your C program
(i.e. not saved to disk).
They are simply drawn on the screen.
You may also like to experiment with other options such
as "Toggle auto-indent".
|
|
Top of Page
|
|
CRICOS Provider Code: 00126G
|
|