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

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.
主站蜘蛛池模板: 都匀市| 凤翔县| 方城县| 秀山| 牡丹江市| 炉霍县| 米易县| 镇坪县| 额济纳旗| 沂南县| 揭西县| 健康| 乡城县| 化州市| 山西省| 常山县| 佛冈县| 辽阳市| 景泰县| 白水县| 阿勒泰市| 涞水县| 长武县| 清新县| 常州市| 嘉祥县| 巴塘县| 万山特区| 益阳市| 信阳市| 新田县| 白朗县| 阜新市| 青铜峡市| 荆门市| 白水县| 万全县| 四会市| 景宁| 胶州市| 垫江县|