write_and_run_your_programs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
write_and_run_your_programs [2018/05/14 18:06] – yutaka | write_and_run_your_programs [2018/05/14 18:44] – yutaka | ||
---|---|---|---|
Line 87: | Line 87: | ||
This is useful because a sequence of programming (edit-compile-run-edit again) can be done by switching two windows. | This is useful because a sequence of programming (edit-compile-run-edit again) can be done by switching two windows. | ||
+ | ==== Run vi or vim ==== | ||
+ | |||
+ | **If you are satisfied with //gedit//, please skip this section and move to the next, or you will get confused.** | ||
+ | |||
+ | Linux has a traditional text editor, //vi// (actually //vim// installed in many systems). | ||
+ | This editor runs in the terminal so it doesn' | ||
+ | The //vi// editor is designed to intensively use keyboard without graphical guidance so it looks cryptic for new users. | ||
+ | |||
+ | To invoke vi, type '' | ||
+ | |||
+ | $ vi prog1.f90 | ||
+ | |||
+ | If you accidentally run vi, 1) hit //Esc// key once, 2) type '': | ||
+ | |||
+ | :q | ||
+ | |||
+ | The editor has 2 modes: //command mode// and //edit mode//. | ||
+ | You have to switch the modes inside the editor to do what you want to do. | ||
+ | |||
+ | * When starting the editor, you are in the command mode which accept the command to action such as exit the program, save a file, search a text etc. | ||
+ | * To input the text, push '' | ||
+ | * To save the file, hit Esc key to come back to the command mode, type '': | ||
+ | * To edit the file again, push '' | ||
+ | * You have to move to the edit mode and come back to the command mode repeatedly to finish the program. Then type '': | ||
+ | |||
+ | {{: | ||
+ | |||
+ | You should know which which model are you currently working. | ||
+ | |||
+ | Hints: | ||
+ | |||
+ | * If you get lost, hit the Esc key (on the top left of the keyboard) a few times so you will move to the command mode. | ||
+ | * The simplest way to quit vi: hit the Esc key many times, type '': | ||
===== Write, compile, and run the first program ===== | ===== Write, compile, and run the first program ===== | ||
Line 134: | Line 167: | ||
The program shows some message on the screen and exits. | The program shows some message on the screen and exits. | ||
- | |||
==== Some compilation options ==== | ==== Some compilation options ==== |
write_and_run_your_programs.txt · Last modified: 2024/03/25 18:22 by 127.0.0.1