It's UWAweek 10 (1st semester, week 2)


This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying selected article
Showing 1 of 1168 articles.
Currently 3 other people reading this forum.

 UWA week 32 (2nd semester, week 3) ↓
SVG not supported

Login to reply


Using foreground/background job control in your shell The traditional (40+ year old) way to run the vim editor is inside the same window that receives your shell commands. I choose to edit files and compile them in the same window (and in most of my work) to simply save screen real-estate. So you can run the vim editor in the single window by simply executing the 'vim file.c' command at the prompt, and then leaving the editor with either :wq!<RETURN> or ZZ when finished editing (or just :q! to quit without saving changes). The second part is more complex, and will be covered later in the unit. Processes may be in one of a number of states - (simplified definition): - running in the foreground, receiving keyboard input - suspended, not running, receiving no input, or - running in the background, receiving no input. When working I first invoke a copy of the vim editor, and it runs in the foreground receiving input from the keyboard. I then type 2 keys at once - Control-Z - which suspends the vim process. The shell notices this, and issues the next prompt, and I can run the compiler again (or any other commands). When I wish to resume execution of the vim process - shifting it from suspended to foreground - I type 'fg', the shell becomes suspended, vim resumes, detects that it's again running in the foreground, and redraws the screen. For this sequence to be effective, you also need the editor to write its changes to disk before becoming suspended. Either you can do this manually, which gets tiring and you may forget, or you can ask vim to do it automatically by setting an internal vim setting - :set autowrite<RETURN> Then, just before vim is suspended it writes its changes to disk, and the next compilation, etc, will be performed using the updated C file. In much the same way that shell aliases can be saved between visits, vim's settings can also be saved in a file named ~/.vimrc which you can edit with vim itself, appending the line: set autowrite (no leading colon). ____ See also:

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy