3

Is the a difference between /: and : in vi?

6

Are you referring to vi commands?

Typing : in the vi command prompt means that you are going to write vi commands. For instance:

:x == save and exit

:w == save,

:q == quit,

:s/// == search and replace, etc.

Typing / means performing a search. So /: means that you are searching for an instance of ":" (colon) in your file.

|improve this answer|||||
0

Vi have two modes of operation:

  • Command Mode
  • Insert Mode

In command mode, the letters of the keyboard perform editing functions (like moving the cursor, deleting text, for example). To enter command mode, press the Esc key.

In insert mode, the letters you type form words and sentences. Unlike many word processors, vi starts up in command mode.

What does entering the : key mean in Vi/M editors?

The vi editor editor is built on an earlier Unix text editor called ex. ex commands can be used within vi. ex commands begin with a : (colon) and end with a . The command is displayed on the status line as you type. Some ex commands are useful when saving and closing files.

To save the edits you have made, but leave vi running and your file open:

  1. Press Esc
  2. Type :w
  3. Press Return.

/ is used for searching while in command mode

  1. Type / (slash).
  2. Enter the text string you want to search for in the file.
  3. Press Return.

So /: will search for the ":" character in subject file, while : will take user to command mode, where ex commands can be executed.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.