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

  • Mastering Vim
  • Ruslan Osipov
  • 274字
  • 2021-06-10 18:51:24

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.
主站蜘蛛池模板: 贵阳市| 绥滨县| 泰州市| 边坝县| 天峨县| 连城县| 泾川县| 仪陇县| 辽阳县| 左贡县| 海伦市| 峨眉山市| 榆社县| 双牌县| 大理市| 南开区| 徐州市| 武邑县| 万年县| 咸宁市| 疏勒县| 大渡口区| 织金县| 仙桃市| 宁波市| 兰西县| 疏附县| 汕头市| 上饶市| 莎车县| 荣成市| 中阳县| 米林县| 江永县| 阿坝| 长宁县| 龙岩市| 晋州市| 永丰县| 长子县| 保康县|