1 / 10

VIM

VIM. This is the text editor you will use on the workstation. You can also edit the text files under windows environment and upload it to the workstation using FTP. It will be a very efficient tool is you are familiar with it. VIM. Basic usage : vim <filename>

Download Presentation

VIM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VIM • This is the text editor you will use on the workstation. • You can also edit the text files under windows environment and upload it to the workstation using FTP. • It will be a very efficient tool is you are familiar with it.

  2. VIM • Basic usage: vim <filename> • It will create a new file for you if no such file exists. • You can just type vim a.c to start editing a c source file.

  3. VIM • The first thing you have to know about Vim is how to exit it. <press ESC if you are in the editing mode> • :q – leave vim • :q! – leave without saving • :wq – save and leave • You can use :w to save without leave and :w <filename> to save in a new name.

  4. VIM • Now you can understand that Vim is a monster filled with hotkeys and commands. • Don’t be frightened by that, you only needs “i”, “:q!”, “:wq” and “ESC” in order to use Vim. • You can press any of the following keys to enter the editing mode: a, i, o, r, A, I, O, R, each has a different function.

  5. VIM • Basic operations in Normal mode: • 0 / $– go to the beginning/end of the line. • G / gg– go to the beginning/end of the file. • x / dd– delete a world / a line. • yy /p– copy / paste • u / <ctrl>+r– undo / redo • / / n– search / search next • <ctrl>+v– block choose

  6. VIM • You can also use number + command to execute multiple commands. • For example, 2dd deletes 2 lines, 2yy copies 2 lines. • Learn Vim by experience, do not try to recite all of the commands. • You can also download a windows version of Vim

  7. Shell Script • Shell script is just like a .bat file in windows, can be used to execute batch works. • Furthermore, you can use if-then, for-loop etc., in your shell script so you can set up some automatic works. • Use sh <filename> to execute it. Or You can just use chmod command to make the file executable.

  8. Shell Script • All shell script starts with #!/bin bash to specify the shell name. • Other #s beside this line are considered as comment lines. • Spaces and new lines are ignored. • <Enter> is considered as “execute”

  9. Shell Script • I won’t talk too much about Shell Script here because it will become Unix course. • Let’s try a small example. #!/bin/bash #This is the demo bash script echo "We are going to use Vim to open a file." read -p "Please insert the file name: " filename echo "the file name is" $filename", are you sure?(y/n)" read yn if [ $yn == "y" ]; then vim temp/$filename else echo "command failed" fi

More Related