官术网_书友最值得收藏!

Opening files

First, start your favorite Command Prompt (Terminal in Linux and macOS, Cygwin in Windows). We'll be working on a very basic Python application. For simplicity's sake, let's make a simple square root calculator. Run the following command:

$ vim animal_farm.py
If you're using gVim—you can open a file by going into a File menu and choosing Open. Sometimes graphical interface is exactly what you need!

This opens a file named animal_farm.py. If the file existed, you'd see its contents here, but since it doesn't, we're greeted by an empty screen, as shown in the following example:

You can tell that the file doesn't exist by the [New File] text next to a file name in the status line at the bottom of the screen. Woohoo! You've just opened your first file with Vim!

Vim's status line often contains a lot of useful information. That's the primary way for Vim to communicate with a user, so do keep an eye out for messages in the status line!

If you already have Vim open—you can load a file by typing the following, and hitting Enter:

:e animal_farm.py

You have just executed your first Vim command! Pressing colon character : enters a command-line mode, which lets you enter a line of text which Vim will interpret as a command. Commands are terminated by hitting the Enter key, which allows you to perform various complex operations, as well as accessing your system's Command line. Command :e stands for edit.

Vim help often refers to the  Enter key as a <CR>, which stands for carriage return.
主站蜘蛛池模板: 江门市| 河西区| 武陟县| 玉林市| 蒙山县| 平阴县| 叙永县| 迁西县| 沙雅县| 永胜县| 沂源县| 荥经县| 萝北县| 筠连县| 山阴县| 峡江县| 黄平县| 海晏县| 科技| 杨浦区| 柘荣县| 准格尔旗| 江永县| 西华县| 铜鼓县| 葫芦岛市| 盐津县| 新晃| 天祝| 岳普湖县| 革吉县| 正阳县| 邳州市| 华容县| 定远县| 晋州市| 石渠县| 余姚市| 清河县| 个旧市| 东海县|