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

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.
主站蜘蛛池模板: 武功县| 衡阳市| 玉林市| 广昌县| 苏尼特左旗| 合川市| 天等县| 普定县| 会同县| 大宁县| 谷城县| 基隆市| 封丘县| 博野县| 大冶市| 五常市| 东莞市| 当阳市| 时尚| 巴东县| 商都县| 唐海县| 金华市| 台湾省| 景德镇市| 抚宁县| 滦南县| 任丘市| 怀安县| 丰城市| 东平县| 翁牛特旗| 新宾| 宝丰县| 扎兰屯市| 隆昌县| 神池县| 鹰潭市| 抚松县| 陈巴尔虎旗| 达日县|